create api for register road observation
This commit is contained in:
@@ -88,4 +88,46 @@ class RoadObservationTableService
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']);
|
||||
}
|
||||
|
||||
public function complaintsIndex(Request $request)
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if ($user->hasPermissionTo('show-fast-react')) {
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id');
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-province')) {
|
||||
|
||||
if (is_null($user->province_id)) {
|
||||
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->where('road_observeds.province_id', '=', $user->province_id);
|
||||
|
||||
}
|
||||
elseif ($user->hasPermissionTo('show-fast-react-edarate-shahri')) {
|
||||
|
||||
if (is_null($user->edarate_shahri_id)) {
|
||||
return $this->errorResponse('اداره ای برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->where('rms_status', '=', 0)
|
||||
->whereNotNull('edarate_shahri_id')
|
||||
->where('edarate_shahri_id', '=', $user->edarate_shahri_id);
|
||||
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
allowedFilters: ['*'],
|
||||
allowedSortings: ['*']
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user