- Menambahkan model, migrasi, seed, controller, request, dan tampilan untuk fitur Jenis Kartu. - Menambahkan routing dan breadcrumbs untuk Jenis Kartu. - Mengimplementasikan fungsi CRUD, ekspor data ke Excel, dan penghapusan multiple records pada Jenis Kartu. - Memperbarui `module.json` untuk menampilkan menu Jenis Kartu di bagian Master. - Menambah seeder untuk data awal Jenis Kartu. Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
42 lines
1.0 KiB
PHP
42 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Modules\Webstatement\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class JenisKartuRequest 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
|
|
{
|
|
$rules = [
|
|
'code' => 'required|string|max:50',
|
|
'name' => 'required|string|max:255',
|
|
'biaya' => 'required|numeric',
|
|
'authorized_status' => 'nullable|boolean',
|
|
];
|
|
|
|
// Add unique validation for code field on create
|
|
if ($this->isMethod('post')) {
|
|
$rules['code'] .= '|unique:jenis_kartu,code';
|
|
}
|
|
|
|
// Add unique validation for code field on update, excluding the current record
|
|
if ($this->isMethod('put') || $this->isMethod('patch')) {
|
|
$rules['code'] .= '|unique:jenis_kartu,code,' . $this->id;
|
|
}
|
|
|
|
return $rules;
|
|
}
|
|
}
|