Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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 this issue Sep 26, 2023 · 7 comments

Comments

@jesnagifto
Copy link

  • 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
Copy link
Author

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

}

@jesnagifto
Copy link
Author

Screenshot 2023-09-26 131000

@jesnagifto
Copy link
Author

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

@alexoleynik0
Copy link

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
Copy link
Author

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

@Daniel-ccx
Copy link

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

@jesnagifto
Copy link
Author

jesnagifto commented Jan 10, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants