32 lines
905 B
PHP
32 lines
905 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\V3\Mission\TransportaionUnit;
|
|
|
|
use App\Enums\MissionStates;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class AllocateRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return $this->mission->edare_shahri_id == auth()->user()->edarate_shahri_id && $this->mission->state_id == MissionStates::REQUEST_CREATED->value;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'machines' => 'required|array',
|
|
'machines.*' => 'required|integer|exists:cmms_machines,id',
|
|
'driver' => 'required|integer|exists:rahdaran,id'
|
|
];
|
|
}
|
|
}
|