create new middlware and add in route and kernel

This commit is contained in:
2025-04-22 13:45:04 +03:30
parent 1da6414256
commit aef3bfdd94
4 changed files with 38 additions and 27 deletions

View File

@@ -52,14 +52,6 @@ class SafetyAndPrivacyController extends Controller
{
$user = auth()->user();
if ($user->edarate_ostani_id || is_null($user->city_id)) {
return $this->errorResponse('امکان ثبت این مورد برای ادارات استانی و ستادی وجود ندارد!');
}
if (is_null($user->edarate_shahri_id)) {
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
}
$coordinates = explode(',', $request->point);
$item = InfoItem::query()
->where('id', $request->info_id)
@@ -104,14 +96,6 @@ class SafetyAndPrivacyController extends Controller
{
$user = auth()->user();
if ($user->edarate_ostani_id || is_null($user->city_id)) {
return $this->errorResponse('امکان ثبت این مورد برای ادارات استانی و ستادی وجود ندارد!');
}
if (is_null($user->edarate_shahri_id)) {
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
}
DB::transaction(function () use ($request, $safetyAndPrivacy, $user)
{
$judiciary_document = [];
@@ -135,14 +119,6 @@ class SafetyAndPrivacyController extends Controller
{
$user = auth()->user();
if ($user->edarate_ostani_id || is_null($user->city_id)) {
return $this->errorResponse('امکان ثبت این مورد برای ادارات استانی و ستادی وجود ندارد!');
}
if (is_null($user->edarate_shahri_id)) {
return $this->errorResponse('اداره شهری برای شما در سامانه ثبت نشده است!');
}
DB::transaction(function () use ($request, $safetyAndPrivacy, $user) {
$safetyAndPrivacy->update([
'step' => 3,