select required columns

This commit is contained in:
2025-02-22 16:02:19 +03:30
parent e6930f2dfe
commit 0b8b0cef02

View File

@@ -19,7 +19,10 @@ class RoadPatrolTableService
if ($user->hasPermissionTo('show-road-patrol-supervise-cartable')) {
$query = RoadPatrol::query()
->select([])
->select([
'province_fa', 'province_id', 'id', 'edare_id', 'edare_name', 'start_time', 'end_time', 'created_at', 'description',
'distance', 'vehicle_runtime', 'fuel_consumption', 'stop_points,'
])
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
}
elseif ($user->hasPermissionTo('show-road-patrol-supervise-cartable-province')) {
@@ -27,7 +30,10 @@ class RoadPatrolTableService
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
}
$query = RoadPatrol::query()
->select([])
->select([
'province_fa', 'province_id', 'id', 'edare_id', 'edare_name', 'start_time', 'end_time', 'created_at', 'description',
'distance', 'vehicle_runtime', 'fuel_consumption', 'stop_points,'
])
->where('province_id', '=', $user->province_id)
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
}
@@ -47,7 +53,10 @@ class RoadPatrolTableService
$allowedSortings = ['*'];
$query = RoadPatrol::query()
->select([])
->select([
'province_fa', 'province_id', 'id', 'edare_id', 'edare_name', 'start_time', 'end_time', 'created_at', 'description',
'distance', 'vehicle_runtime', 'fuel_consumption', 'stop_points,'
])
->where('operator_id', '=', auth()->user()->id)
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));