39 lines
893 B
PHP
39 lines
893 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests;
|
||
|
|
|
||
|
|
use App\Enums\WorkspaceUserRole;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
|
||
|
|
class BulkNotifyRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*/
|
||
|
|
public function authorize(): bool
|
||
|
|
{
|
||
|
|
$user = $this->user();
|
||
|
|
|
||
|
|
if (! $user) {
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
$workspaceUser = $user->currentWorkspaceUser();
|
||
|
|
|
||
|
|
return ! $workspaceUser->role->is(WorkspaceUserRole::Worker);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
||
|
|
*/
|
||
|
|
public function rules(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'declaration_ids' => ['required', 'array', 'min:1', 'max:100'],
|
||
|
|
'declaration_ids.*' => ['integer'],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|