46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin\Finance;
|
|
|
|
use App\Concerns\CurrencyStripping;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Override;
|
|
|
|
class CashTransactionRequest extends FormRequest
|
|
{
|
|
use CurrencyStripping;
|
|
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
#[Override]
|
|
public function prepareForValidation(): void
|
|
{
|
|
$this->merge($this->stripCurrencyDot($this->validated(), 'amount'));
|
|
}
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'amount' => ['required', 'integer', 'min:1'],
|
|
'description' => ['required', 'string', 'max:100'],
|
|
'receipt_key' => ['required', 'string', 'max:500'],
|
|
'file_size' => ['nullable', 'integer', 'min:1'],
|
|
'file_mime_type' => ['nullable', 'string', 'in:image/jpeg,image/png,image/webp,image/gif'],
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'amount' => 'jumlah',
|
|
'description' => 'keterangan',
|
|
'receipt_key' => 'bukti',
|
|
'file_size' => 'ukuran file',
|
|
'file_mime_type' => 'tipe file',
|
|
];
|
|
}
|
|
}
|