|
|
|
<?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', // Pastikan peti_id ada dalam tabel petis
|
|
|
|
'exit_at' => 'required|date',
|
|
|
|
'est_pengembalian' => 'required|date', // Estimasi pengembalian harus setelah exit_at
|
|
|
|
'exit_warehouse' => 'required',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function messages()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'peti_id.required' => 'Bidang Detail Peti wajib diisi.',
|
|
|
|
'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.',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|