laravel-admin
laravel-admin copied to clipboard
In the json fields two-dimentional array key is not properly working.... more then 2 values not saved in to the DB..
- Laravel Version: #.#.#
- PHP Version:
- Laravel-admin: #.#.#
Description:
my controller code is $form->table('matching_profile','Matching Profile Details', function ($table) {
$table->text('Matching Profile Id')->rules('required');
$table->text('Matching Profile Name')->rules('required');
$table->datetime('data_date_time')->default(today()->format('d-m-Y H:m a'))
->format('DD-MM-YYYY h:mm:ss a');
$table->select('Matching Status')->options(['1'=>'Pending',2=> 'Interest',3=> 'Not Interest',4=> 'Declaine']);
});
model
protected $casts = [
'matching_profile' =>'json',
]; public function setColumnNameAttribute($value) {
}
please help me fast
public function setColumnNameAttribute($value) { $this->attributes['matching_profile'] = json_encode(array_values($value));
}
not saved the more than 4 set values we want many values can add and save
Does it actually named setColumnNameAttribute
in your model? That is an example. See how mutators work in Laravel's models.
It should be named setMatchingProfileAttribute
in your case.
but this can not working.. always this same error showing
key is $this->attributes['matching_profile'] = json_encode(array_values($value));
thank u sir... its fixed
On Wed, Jan 10, 2024 at 8:57 AM Daniel @.***> wrote:
key is $this->attributes['matching_profile'] = json_encode(array_values ($value));
— Reply to this email directly, view it on GitHub https://github.com/z-song/laravel-admin/issues/5825#issuecomment-1884132893, or unsubscribe https://github.com/notifications/unsubscribe-auth/A5OU22LN4WG46K5CPZ4DWITYNYDDBAVCNFSM6AAAAAA5HHYW7KVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBUGEZTEOBZGM . You are receiving this because you authored the thread.Message ID: @.***>