menambahkan fitur export to excel di menu master ijin usaha
This commit is contained in:
48
app/Http/Requests/KJPPRequest.php
Normal file
48
app/Http/Requests/KJPPRequest.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class KJPPRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|string|not_regex:/^\d+$/|max:255',
|
||||
'jenis_kantor' => 'required'
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:kjpp,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique: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 KJPP harus diisi!',
|
||||
'code.max' => 'Kode KJPP maksimal 255 huruf!',
|
||||
'code.unique' => 'Kode KJPP tidak boleh sama!',
|
||||
'name.required' => 'Nama KJPP harus diisi!',
|
||||
'name.not_regex' => 'Nama KJPP harus berupa huruf!',
|
||||
'name.max' => 'Nama KJPP maksimal 255 huruf!',
|
||||
'jenis_kantor.required' => 'Jenis Kantor harus diisi!'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user