ldc-mesbr-app/app/Http/Requests/Customers/SearchCustomers.php
2025-11-07 11:08:02 +01:00

33 lines
710 B
PHP

<?php
namespace App\Http\Requests\Customers;
use App\Enums\UserRoles;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;
class SearchCustomers extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return Auth::check()
&& in_array(Auth::user()->roles, [UserRoles::superadmin()->value, UserRoles::admin()->value]);
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'sometimes|email|required'
];
}
}