61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Contracts\Validation\ValidationRule;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class AdminUpdateRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'first_name' => [
|
|
'required',
|
|
'persian_alpha',
|
|
'min:2',
|
|
'max:100',
|
|
],
|
|
'last_name' => [
|
|
'required',
|
|
'persian_alpha',
|
|
'min:3',
|
|
'max:100',
|
|
],
|
|
|
|
'username' => [
|
|
'required',
|
|
'unique:admins,username,' . $this->route('admin')->id,
|
|
],
|
|
|
|
'email' => [
|
|
'required',
|
|
'email',
|
|
'unique:admins,email,' . $this->route('admin')->id,
|
|
],
|
|
|
|
'password' => ['nullable', 'min:8'],
|
|
|
|
'status' => ['required'],
|
|
|
|
'admin_view' => ['nullable', 'boolean'],
|
|
'admin_create' => ['nullable', 'boolean'],
|
|
'admin_edit' => ['nullable', 'boolean'],
|
|
'admin_delete' => ['nullable', 'boolean'],
|
|
];
|
|
}
|
|
}
|