create new dependensy for accident controller
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Requests\V3\AccidentReceipt;
|
||||
|
||||
use App\Enums\AccidentStates;
|
||||
use App\Models\Accident;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class ConfirmPaymentInfoRequest extends FormRequest
|
||||
@@ -9,9 +11,9 @@ class ConfirmPaymentInfoRequest extends FormRequest
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
public function authorize(Accident $accident): bool
|
||||
{
|
||||
return true;
|
||||
return $accident->status === AccidentStates::SODOR_NAME_BIME_VA_DAGHI->value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Http\Requests\V3\AccidentReceipt;
|
||||
|
||||
use App\Enums\AccidentStates;
|
||||
use App\Models\Accident;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class UpdateRequest extends FormRequest
|
||||
@@ -9,9 +11,9 @@ class UpdateRequest extends FormRequest
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
public function authorize(Accident $accident): bool
|
||||
{
|
||||
return true;
|
||||
return $accident->status === AccidentStates::BEDON_EGHDAM->value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -25,10 +27,10 @@ class UpdateRequest extends FormRequest
|
||||
'province_id' => 'required|integer|exists:provinces,id',
|
||||
'city_id' => 'required|integer|exists:cities,id',
|
||||
'axis_name' => 'required|string',
|
||||
'driver_name' => 'required|string',
|
||||
'plaque' => 'required|string',
|
||||
'driver_national_code' => 'required|string',
|
||||
'driver_phone_number' => 'required|string',
|
||||
'driver_name' => 'required_if:is_foreign,0|string',
|
||||
'plaque' => 'required_if:is_foreign,0|string',
|
||||
'driver_national_code' => 'required_if:is_foreign,0|string',
|
||||
'driver_phone_number' => 'required_if:is_foreign,0|string',
|
||||
'lat' => 'required|numeric',
|
||||
'lng' => 'required|numeric',
|
||||
'accident_type' => 'required|integer',
|
||||
|
||||
Reference in New Issue
Block a user