feat(daftar-pustaka) : tambah daftar pustaka dan categori pustaka, lihat detail, tambah, edit
This commit is contained in:
33
app/Http/Requests/CategoryDaftarPustakaRequest.php
Normal file
33
app/Http/Requests/CategoryDaftarPustakaRequest.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CategoryDaftarPustakaRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
$rules = [
|
||||
'name' => 'required|max:255',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['code'] = 'required|max:50|unique:category_daftar_pustaka,code,' . $this->id;
|
||||
} else {
|
||||
$rules['code'] = 'required|max:50|unique:category_daftar_pustaka,code';
|
||||
}
|
||||
return $rules;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*/
|
||||
public function authorize(): bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user