24 lines
516 B
PHP
24 lines
516 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Directory;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class DepartmentRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
$department = $this->route('department');
|
|
|
|
return [
|
|
'name' => ['required', 'string', 'max:255', 'unique:departments,name'.($department ? ','.$department->id : '')],
|
|
'description' => ['nullable', 'string'],
|
|
];
|
|
}
|
|
}
|