fix code for routs and service
This commit is contained in:
@@ -24,12 +24,12 @@ class RoadObservationTableService
|
||||
];
|
||||
|
||||
|
||||
if ($user->hasPermissionTo('supervise-fast-react')) {
|
||||
if ($user->hasPermissionTo('show-fast-react')) {
|
||||
$query = RoadObserved::query()->leftjoin('edarate_shahri', 'road_observeds.edarate_shahri_id', 'edarate_shahri.id')
|
||||
->whereNotNull('road_observeds.status')
|
||||
->select($fields);
|
||||
}
|
||||
elseif ($user->hasPermissionTo('supervise-fast-react-province'))
|
||||
elseif ($user->hasPermissionTo('show-fast-react-province'))
|
||||
{
|
||||
if (is_null($user->province_id))
|
||||
{
|
||||
@@ -53,6 +53,10 @@ class RoadObservationTableService
|
||||
{
|
||||
$user = auth()->user();
|
||||
|
||||
if (is_null($user->edarate_shahri_id)) {
|
||||
return $this->errorResponse('ادارهای برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
|
||||
$fields = [
|
||||
'fk_RegisteredEventMessage', 'road_observeds.id', 'Title', 'road_observeds.created_at',
|
||||
'lat', 'lng', 'FeatureTypeTitle', 'Description', 'MobileForSendEventSms',
|
||||
@@ -66,20 +70,9 @@ class RoadObservationTableService
|
||||
->whereNotNull('road_observeds.province_id')
|
||||
->whereNotNull('status')
|
||||
->leftJoin('edarate_shahri', 'road_observeds.edarate_shahri_id', '=', 'edarate_shahri.id')
|
||||
->where('edarate_shahri_id', $user->edarate_shahri_id)
|
||||
->select($fields);
|
||||
|
||||
if ($user->hasPermissionTo('show-fast-react-province')) {
|
||||
if (is_null($user->province_id)) {
|
||||
return $this->errorResponse('استانی برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
$query->where('rms_province_id', $user->province_id);
|
||||
} elseif ($user->hasPermissionTo('show-fast-react-edarate-shahri')) {
|
||||
if (is_null($user->edarate_shahri_id)) {
|
||||
return $this->errorResponse('ادارهای برای شما در سامانه ثبت نشده است!');
|
||||
}
|
||||
$query->where('edarate_shahri_id', $user->edarate_shahri_id);
|
||||
}
|
||||
|
||||
return DataTableFacade::run(
|
||||
$query,
|
||||
$request,
|
||||
|
||||
Reference in New Issue
Block a user