41 lines
808 B
PHP
41 lines
808 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Finance;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Override;
|
|
|
|
class ExpenseRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
#[Override]
|
|
public function prepareForValidation()
|
|
{
|
|
if ($this->has('amount')) {
|
|
$this->merge([
|
|
'amount' => str_replace('.', '', $this->amount),
|
|
]);
|
|
}
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'amount' => ['required', 'integer', 'min:1'],
|
|
'description' => ['required', 'string', 'max:100'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'amount' => 'jumlah',
|
|
'description' => 'keterangan',
|
|
];
|
|
}
|
|
}
|