You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
46 lines
1.5 KiB
1 year ago
|
<?php
|
||
|
|
||
|
namespace App\Http\Requests;
|
||
|
|
||
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
||
|
class ValidasiCreatePeminjaman 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 [
|
||
|
'peti_id' => 'required|integer', // Pastikan peti_id ada dalam tabel petis
|
||
|
'exit_at' => 'required|date',
|
||
|
'est_pengembalian' => 'required|date', // Estimasi pengembalian harus setelah exit_at
|
||
|
'exit_warehouse' => 'required|integer',
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function messages()
|
||
|
{
|
||
|
return [
|
||
|
'peti_id.required' => 'Bidang Detail Peti wajib diisi.',
|
||
|
'peti_id.integer' => 'Detail Peti harus berupa angka.',
|
||
|
'exit_at.required' => 'Bidang Tanggal Peminjaman wajib diisi.',
|
||
|
'exit_at.date' => 'Bidang Tanggal Peminjaman harus berupa tanggal.',
|
||
|
'est_pengembalian.required' => 'Bidang Estimasi Tanggal Pengembalian wajib diisi.',
|
||
|
'est_pengembalian.date' => 'Bidang Estimasi Tanggal Pengembalian harus berupa tanggal.',
|
||
|
'exit_warehouse.required' => 'Bidang Asal Gudang wajib diisi.',
|
||
|
'exit_warehouse.integer' => 'Asal Gudang harus berupa angka.',
|
||
|
];
|
||
|
}
|
||
|
}
|