laravel-admin icon indicating copy to clipboard operation
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..

Open jesnagifto opened this issue 1 year ago • 7 comments

  • 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

jesnagifto avatar Sep 26 '23 07:09 jesnagifto

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

}

jesnagifto avatar Sep 26 '23 07:09 jesnagifto

Screenshot 2023-09-26 131000

jesnagifto avatar Sep 26 '23 07:09 jesnagifto

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

jesnagifto avatar Sep 26 '23 07:09 jesnagifto

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.

alexoleynik0 avatar Sep 26 '23 14:09 alexoleynik0

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

jesnagifto avatar Dec 11 '23 05:12 jesnagifto

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

Daniel-ccx avatar Jan 10 '24 03:01 Daniel-ccx

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

jesnagifto avatar Jan 10 '24 05:01 jesnagifto