|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Transfer;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
class ValidasiCreateTransfer 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', // Required, peti_id harus ada di tabel petis
|
|
|
|
'source_warehouse' => 'required', // Optional, source_warehouse harus ada di tabel m_warehouses
|
|
|
|
'destination_warehouse' => 'required', // Optional, destination_warehouse harus ada di tabel m_warehouses
|
|
|
|
'name_customer' => 'required', // Optional, name_customer harus ada di tabel customers
|
|
|
|
'date' => 'required', // Optional, harus berupa tanggal
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the error messages for the defined validation rules.
|
|
|
|
*/
|
|
|
|
public function messages(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'peti_id.required' => 'Peti harus diisi',
|
|
|
|
'source_warehouse.required' => 'Source Warehouse harus diisi',
|
|
|
|
'destination_warehouse.required' => 'Destination Warehouse harus diisi',
|
|
|
|
'name_customer.required' => 'Nama Customer harus diisi',
|
|
|
|
'date.required' => 'Tanggal harus diisi',
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|