use polyline encoder for command

This commit is contained in:
2026-06-14 08:50:36 +03:30
parent 5f2d214a56
commit 17a6e903ae
4 changed files with 12 additions and 4 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Console\Commands;
use App\Models\Mission;
use App\Services\PolylineEncoder;
use Illuminate\Console\Command;
@@ -24,8 +25,15 @@ class EncodePolyLineCommand extends Command
/**
* Execute the console command.
*/
public function handle(PolylineEncoder $polylineEncoder)
public function handle(PolylineEncoder $polylineEncoder): void
{
Mission::query()->whereNotNull('area')->each(function ($mission) use ($polylineEncoder) {
$encodedValue = $polylineEncoder->encodePolyLine($mission, lng_lat_format:true);
$mission->update([
'encoded_route' => $encodedValue,
]);
});
$this->info("updated successfully");
}
}

View File

@@ -109,7 +109,7 @@ class ReportMachineController extends Controller
allowedSortings: ['*'],
allowedSelects: [
'id', 'province_id', 'province_name', 'city_id', 'city_name',
'end_km', 'km', 'driver_name', 'state_name',
'end_km', 'km', 'driver_name', 'state_name', 'station_name'
]
);
}

View File

@@ -41,7 +41,7 @@ class RequestPortalController extends Controller
return response()->json($requestPortalService->datatable($request));
}
public function violations(Request $request): JsonResponse
public function violations(Request $request): array
{
$query = MissionViolation::query()->where([
['status', '=', MissionViolationStatus::BEDON_EGHDAM->value],