Add custom fields to JenisLegalitasJaminan
Added `custom_field` and `custom_field_type` columns to the `jenis_legalitas_jaminan` table. Updated model, migration, and request files to handle these new fields, ensuring they are optional and have a maximum length of 255 characters.
This commit is contained in:
@@ -15,9 +15,11 @@
|
||||
: array
|
||||
{
|
||||
return [
|
||||
'code' => 'required|max:6',
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|max:255',
|
||||
'code' => 'required|max:6',
|
||||
'name' => 'required|max:255',
|
||||
'slug' => 'required|max:255',
|
||||
'custom_field' => 'nullable|max:255',
|
||||
'custom_field_type' => 'nullable|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -32,7 +34,7 @@
|
||||
|
||||
public function prepareForValidation()
|
||||
{
|
||||
if($this->method() == 'POST' && $this->code == null) {
|
||||
if ($this->method() == 'POST' && $this->code == null) {
|
||||
$this->merge([
|
||||
'code' => IdGenerator::generate(
|
||||
['table' => 'jenis_legalitas_jaminan', 'length' => 6, 'prefix' => 'JLJ', 'field' => 'code'],
|
||||
@@ -41,7 +43,7 @@
|
||||
]);
|
||||
} else {
|
||||
$this->merge([
|
||||
'slug' => Str::slug($this->name),
|
||||
'slug' => Str::slug($this->name),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user