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.
48 lines
1.8 KiB
48 lines
1.8 KiB
<?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 |
|
'customer_id' => 'required|integer', // Pastikan customer_id ada dalam tabel customers |
|
'exit_at' => 'required|date', |
|
'est_pengembalian' => 'required|date', // Estimasi pengembalian harus setelah exit_at |
|
'warehouse_id' => 'required|integer', // Pastikan warehouse_id ada dalam tabel m_warehouses |
|
]; |
|
} |
|
|
|
public function messages() |
|
{ |
|
return [ |
|
'peti_id.required' => 'Bidang Detail Peti wajib diisi.', |
|
'peti_id.integer' => 'Bidang Detail Peti harus berupa angka.', |
|
'customer_id.required' => 'Bidang Customer wajib diisi.', |
|
'customer_id.integer' => 'Bidang Customer 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.', |
|
'warehouse_id.required' => 'Bidang Asal Gudang wajib diisi.', |
|
'warehouse_id.integer' => 'Bidang Asal Gudang harus berupa angka.', |
|
]; |
|
} |
|
}
|
|
|