z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.15k stars 2.82k forks source link

In the json fields two-dimentional array key is not properly working.... more then 2 values not saved in to the DB.. #5825

Open jesnagifto opened 1 year ago

jesnagifto commented 1 year ago

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

jesnagifto commented 1 year ago

public function setColumnNameAttribute($value) { $this->attributes['matching_profile'] = json_encode(array_values($value));

}

jesnagifto commented 1 year ago

Screenshot 2023-09-26 131000

jesnagifto commented 1 year ago

not saved the more than 4 set values we want many values can add and save

alexoleynik0 commented 1 year ago

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.

jesnagifto commented 11 months ago

but this can not working.. always this same error showing

Daniel-ccx commented 10 months ago

key is $this->attributes['matching_profile'] = json_encode(_arrayvalues($value));

jesnagifto commented 10 months ago

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: @.***>