create new controller and dependency for change statuse and create new permission
This commit is contained in:
32
app/Http/Requests/V3/AccidentReceipt/ChangeStatusRequest.php
Normal file
32
app/Http/Requests/V3/AccidentReceipt/ChangeStatusRequest.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests\V3\AccidentReceipt;
|
||||
|
||||
use App\Enums\AccidentStates;
|
||||
use Illuminate\Contracts\Validation\ValidationRule;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class ChangeStatusRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return Auth::user()->hasPermissionTo('change-accident-status');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, ValidationRule|array|string>
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
return [
|
||||
'status_id' => 'required',
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user