41 lines
985 B
PHP
41 lines
985 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ExportLaporanRequest 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.
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'filter' => 'required|in:hari,bulan',
|
|
'format' => 'required|in:pdf,xlsx,csv',
|
|
'page' => 'nullable',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get custom messages for validator errors.
|
|
*/
|
|
public function messages(): array
|
|
{
|
|
return [
|
|
'filter.required' => 'Filter harus diisi',
|
|
'filter.in' => 'Filter harus berupa "hari" atau "bulan"',
|
|
'format.required' => 'Format export harus diisi',
|
|
'format.in' => 'Format export harus berupa "pdf", "xlsx", atau "csv"',
|
|
];
|
|
}
|
|
} |