42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Employee;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class DepartmentRequest 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, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'department_code' => ['required', 'string', 'max:255'],
|
|
'department_name' => ['required', 'string', 'max:255']
|
|
];
|
|
}
|
|
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'department_code.required' => 'Kode jurusan harus diisi.',
|
|
'department_code.string' => 'Kode jurusan harus berupa teks.',
|
|
'department_code.max' => 'Kode jurusan tidak boleh lebih dari 255 karakter.',
|
|
'department_name.required' => 'Nama jurusan harus diisi.',
|
|
'department_name.string' => 'Nama jurusan harus berupa teks.',
|
|
'department_name.max' => 'Nama jurusan tidak boleh lebih dari 255 karakter.',
|
|
];
|
|
}
|
|
}
|