create and fix code
This commit is contained in:
@@ -11,9 +11,9 @@ class OperatorService
|
||||
public function dataTable(Request $request, $loadRelations = false)
|
||||
{
|
||||
$query = RoadItemsProject::query()
|
||||
->with('mission:id')
|
||||
->where('is_new', '=', 1)
|
||||
->where('user_id', '=', auth()->user()->id)
|
||||
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
|
||||
->where('user_id', '=', auth()->user()->id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
@@ -23,7 +23,8 @@ class OperatorService
|
||||
allowedSelects: [
|
||||
'id', 'province_fa', 'edarat_name', 'supervisor_description', 'item', 'item_fa',
|
||||
'sub_item', 'sub_item_fa', 'sub_item_data', 'unit_fa', 'start_lat', 'start_lng',
|
||||
'end_lat', 'end_lng', 'activity_date_time', 'created_at', 'status_fa', 'status'
|
||||
'end_lat', 'end_lng', 'activity_date_time', 'created_at', 'status_fa', 'status',
|
||||
'mission_id'
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,15 +20,15 @@ class SupervisorService
|
||||
|
||||
if ($user->hasPermissionTo('show-road-item-supervise-cartable')) {
|
||||
$query = RoadItemsProject::query()
|
||||
->where('is_new', 1)
|
||||
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
|
||||
->with('mission:id')
|
||||
->where('is_new', 1);
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-road-item-supervise-cartable-province')) {
|
||||
throw_if(is_null($user->province_id), new ProhibitedAction('استانی برای شما در سامانه ثبت نشده است!'));
|
||||
$query = RoadItemsProject::query()
|
||||
->with('mission:id')
|
||||
->where('is_new', 1)
|
||||
->where('province_id', auth()->user()->province_id)
|
||||
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
|
||||
->where('province_id', auth()->user()->province_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
@@ -39,7 +39,8 @@ class SupervisorService
|
||||
allowedSelects: [
|
||||
'id', 'province_fa', 'edarat_name', 'item', 'item_fa', 'sub_item',
|
||||
'sub_item_fa', 'sub_item_data', 'unit_fa', 'start_lat', 'start_lng',
|
||||
'end_lat', 'end_lng', 'activity_date_time', 'created_at', 'status_fa', 'status'
|
||||
'end_lat', 'end_lng', 'activity_date_time', 'created_at', 'status_fa',
|
||||
'status', 'mission_id'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ class OperatorService
|
||||
public function dataTable(Request $request, $loadRelations = false)
|
||||
{
|
||||
$query = RoadPatrol::query()
|
||||
->where('operator_id', '=', auth()->user()->id)
|
||||
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
|
||||
->with('mission:id')
|
||||
->where('operator_id', '=', auth()->user()->id);
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
@@ -23,7 +23,7 @@ class OperatorService
|
||||
allowedSelects: [
|
||||
'province_fa', 'province_id', 'id', 'edare_id', 'edare_name',
|
||||
'start_time', 'end_time', 'created_at', 'description',
|
||||
'distance', 'vehicle_runtime', 'fuel_consumption', 'stop_points'
|
||||
'distance', 'vehicle_runtime', 'fuel_consumption', 'stop_points', 'mission_id'
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class SupervisorService
|
||||
|
||||
if ($user->hasPermissionTo('show-road-patrol-supervise-cartable')) {
|
||||
$query = RoadPatrol::query()
|
||||
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
|
||||
->with('mission:id');
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-road-patrol-supervise-cartable-province'))
|
||||
{
|
||||
@@ -29,7 +29,7 @@ class SupervisorService
|
||||
|
||||
$query = RoadPatrol::query()
|
||||
->where('province_id', '=', $user->province_id)
|
||||
->when($loadRelations, fn ($query) => $query->with(['rahdaran:id,name,code', 'cmmsMachines:id,machine_code,car_name,plak_number']));
|
||||
->with('mission:id');
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
@@ -40,7 +40,8 @@ class SupervisorService
|
||||
allowedSelects: [
|
||||
'province_fa', 'province_id', 'id', 'edare_id', 'edare_name',
|
||||
'start_time', 'end_time', 'created_at', 'description',
|
||||
'distance', 'vehicle_runtime', 'fuel_consumption', 'stop_points'
|
||||
'distance', 'vehicle_runtime', 'fuel_consumption', 'stop_points',
|
||||
'mission_id'
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user