feat(daftar-pustaka) : tambah daftar pustaka dan categori pustaka, lihat detail, tambah, edit
This commit is contained in:
38
app/Http/Requests/DaftarPustakaRequest.php
Normal file
38
app/Http/Requests/DaftarPustakaRequest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Lpj\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class DaftarPustakaRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
|
||||
$rules = [
|
||||
'judul' => 'required|max:255',
|
||||
'category_id' => 'required',
|
||||
'deskripsi' => 'nullable',
|
||||
];
|
||||
|
||||
if ($this->method() == 'PUT') {
|
||||
$rules['attachment'] = 'nullable|mimes:pdf,jpg,jpeg,png,gif';
|
||||
} else {
|
||||
$rules['attachment'] = 'required|mimes:pdf,jpg,jpeg,png,gif';
|
||||
}
|
||||
|
||||
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