Files
basicdata/app/Http/Requests/CurrencyRequest.php
Daeng Deni Mardaeni 1b692215b8 feat(currency): tambahkan atribut simbol dan perbarui tampilan
- Menambahkan kolom simbol pada tabel mata uang di halaman index.
- Menambahkan input simbol pada form pembuatan mata uang.
- Memperbarui aturan validasi untuk simbol pada CurrencyRequest.
- Memperbarui model Currency untuk menyertakan atribut simbol.
- Memperbarui migrasi untuk menambahkan kolom simbol pada tabel currencies.
2025-04-26 19:34:44 +07:00

43 lines
1.3 KiB
PHP

<?php
namespace Modules\Basicdata\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class CurrencyRequest extends FormRequest
{
/**
* Get the validation rules that apply to the request.
*/
public function rules()
: array
{
$rules = [
'name' => 'required|string|max:255',
'symbol' => 'required|string|max:10',
'decimal_places' => 'nullable|integer|between:0,3',
'status' => 'nullable|boolean',
'authorized_at' => 'nullable|datetime',
'authorized_status' => 'nullable|string|max:1',
'authorized_by' => 'nullable|exists:users,id',
];
if ($this->method() == 'PUT') {
$rules['code'] = 'required|string|max:3|unique:currencies,code,' . $this->id;
} else {
$rules['code'] = 'required|string|max:3|unique:currencies,code';
}
return $rules;
}
/**
* Determine if the user is authorized to make this request.
*/
public function authorize()
: bool
{
return true;
}
}