feat: consolidar desenvolvimentos do portal InvestMoz
This commit is contained in:
@@ -16,6 +16,7 @@ use App\Services\InvestmentZoneOperationalProfile;
|
||||
use App\Services\InvestmentZonePathContext;
|
||||
use App\Services\InvestmentZoneProfileInstallation;
|
||||
use App\Services\InvestmentZones;
|
||||
use App\Services\PublicSearchMetrics;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
@@ -108,6 +109,9 @@ class InvestmentZoneController extends Controller
|
||||
$publicColumns = array_values(array_filter($publicColumns, fn ($column) => Schema::hasColumn('investment_zones', $column)));
|
||||
$rows = $zones->search($filters, $management)->orderBy('name')->orderBy('id')
|
||||
->paginate(12, $management ? ['*'] : $publicColumns)->withQueryString();
|
||||
if (! $management) {
|
||||
app(PublicSearchMetrics::class)->candidate($request, 'zones', $rows->total(), $filters);
|
||||
}
|
||||
$rows->getCollection()->transform(function (InvestmentZone $zone) use ($management) {
|
||||
$territoryPath = app(InvestmentGeography::class)->path($zone->primary_territory_id, $management);
|
||||
$zone->setAttribute('province', collect($territoryPath)->firstWhere('location_type', 'province')->name ?? $zone->province);
|
||||
|
||||
Reference in New Issue
Block a user