Membuat menu master tujuan penilaian kjpp
This commit is contained in:
45
app/Http/Requests/JenisPenilaianKJPPRequest.php
Normal file
45
app/Http/Requests/JenisPenilaianKJPPRequest.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class JenisPenilaianKJPPRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'code' => 'required|max:5',
|
||||
'name' => 'required|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:5|unique:tujuan_penilaian_kjpp,code';
|
||||
}
|
||||
|
||||
return $rules;
|
||||
}
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function messages(): array
|
||||
{
|
||||
return [
|
||||
'code.required' => 'Kode Tujuan Penilaian KJPP Wajib diisi!',
|
||||
'code.max' => 'Kode Tujuan Penilaian KJPP maksimum 5 huruf!',
|
||||
'code.unique' => 'Kode Tujuan Penilaian KJPP tidak boleh sama!',
|
||||
'name.required' => 'Nama Tujuan Penilaian KJPP Wajib diisi!',
|
||||
'name.max' => 'Nama Tujuan Penilaian KJPP Wajib diisi!'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user