You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What i got i try to save a new or an updated rescuer: Call to undefined method App\Models\Rescuer::rescuer_type_id()
So, i ment out, that he try to use the "name" as the relation-ship function in Rescuer.
But the docs says:
[ // Select
'label' => "Category",
'type' => 'select',
'name' => 'category_id', // the db column for the foreign key
// optional
// 'entity' should point to the method that defines the relationship in your Model
// defining entity will make Backpack guess 'model' and 'attribute'
'entity' => 'category',
// optional - manually specify the related model and attribute
'model' => "App\Models\Category", // related model
'attribute' => 'name', // foreign key attribute that is shown to user
// optional - force the related options to be a custom query, instead of all();
'options' => (function ($query) {
return $query->orderBy('name', 'ASC')->where('depth', 1)->get();
}), // you can use this to filter the results show in the select
]
So, name should be the foreignkey. And entoty should be the relation-ship model.
(Caus u think well, than i just use the relationship function.) i got: array_key_exists(): Argument #2 ($array) must be of type array, string given
File: vendor/backpack/crud/src/app/Library/CrudPanel/Traits/FakeFields.php:59
In Backpack version 4.1 i works well.. anybody got an idea?
Edit: I forgot, the form works well. i got an selection-box with the correct relation-ship values from the RescuerType table. Only on store the data, i got the error
The text was updated successfully, but these errors were encountered:
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.
Long questions (I have done X and Y and it won't do Z wtf) - Stackoverflow, using the backpack-for-laravel tag;
Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;
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!
--
Justin Case
The Backpack Robot
busaku
changed the title
[Bug]
[Bug] Cant store relationship (select 1-n) in 5.0.2 free version
Feb 9, 2022
Bug report
What I did
Add "select" field to create and update operation()
What I expected to happen
I can save the data
What happened
I cant save the data
What I've already tried to fix it
Testing all addField([ // settings])
Is it a bug in the latest version of Backpack?
yes 5.0.2
Backpack, Laravel, PHP, DB version
PHP VERSION:
PHP 8.1.2 (cli) (built: Jan 26 2022 16:40:42) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
LARAVEL VERSION:
v9.0.1@afeb58d019b203ecb1a1c4063a66a029ea6bea63
BACKPACK VERSION:
5.0.2@a118a414770e6719732c7629f939d4f9337f5433
Soooo,
My relationship in Rescuer Model:
return $this->hasOne(RescuerType::class, 'id', 'rescuer_type_id');
(Worked in laravel only)
Settings to the field:
What i got i try to save a new or an updated rescuer:
Call to undefined method App\Models\Rescuer::rescuer_type_id()
So, i ment out, that he try to use the "name" as the relation-ship function in Rescuer.
But the docs says:
So, name should be the foreignkey. And entoty should be the relation-ship model.
if i just use this settings:
(Caus u think well, than i just use the relationship function.) i got:
array_key_exists(): Argument #2 ($array) must be of type array, string given
File: vendor/backpack/crud/src/app/Library/CrudPanel/Traits/FakeFields.php:59
In Backpack version 4.1 i works well.. anybody got an idea?
Edit: I forgot, the form works well. i got an selection-box with the correct relation-ship values from the RescuerType table. Only on store the data, i got the error
The text was updated successfully, but these errors were encountered: