-
Notifications
You must be signed in to change notification settings - Fork 915
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
[Bug] decodeJsonCastedAttributes sets field values to null #2880
Comments
Hello there! Thanks for opening your first issue on this repo! Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps a lot in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that. Backpack communication channels:
Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome awesome community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch. Thank you! -- |
Hello @NicklasT There is already an issue raised here about that package: #2725 Not the same error, but I think you will endup in the same road. From my understanding that package comes with My guess is that Backpack picks it up and those fields are treated as translatable, stored in json and not plain text as you are expecting when creating the crud. One work around would be to create a translatable crud for them, a regular one but with translations (as provided by default in that package). backpack docs And here is when I think you will hit the barrier of the issue I referenced later, but I think there is a work around provided by @tabacitu If you come up with a solution we can incorporate in backpack, or even provide some help to someone with same issue, please let us know in the comments. Wish you the best, |
Bug report
What I did
I am trying to use spatie/laravel-tags together with Backpack.
What I expected to happen
Being able to create a simple crud for creating/updating tags.
What happened
Field values set to null by backpack before saving.
What I've already tried to fix it
Here are my fields from my TagCrudController:
When trying to create or update an entry, the name and slug is suddenly null.
I have tracked this down to the following;
In /vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Create.php
Going further to the decodeJsonCastedAttributes function;
In /vendor/backpack/crud/src/app/Library/CrudPanel/Traits/Fields.php
It seems this function is trying to make sure the fields are not json encoded twice, but in this case they are just set to null by this function.
$casted_attributes given back from the tag model are the following:
I don't quite understand what is happening here, or if this is how it is intended to work. If so, what can I do to fix the issue?
Thank you again for all your hard work.
Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:PHP VERSION:
PHP 7.2.24-0ubuntu0.18.04.6 (cli) (built: May 26 2020 13:09:11) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.24-0ubuntu0.18.04.6, Copyright (c) 1999-2018, by Zend Technologies
with Xdebug v2.6.0, Copyright (c) 2002-2018, by Derick Rethans
LARAVEL VERSION:
v7.11.0@f4563bd2e0875c59a1f7967abdbe5cef7f240117
BACKPACK VERSION:
4.1.5@e2c166b065f6b405747db5a5f4d36a2a88f8dc22
The text was updated successfully, but these errors were encountered: