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
I've created a CrudController and the UpdateOperation with a relationship field from a 1 <> n relation.
CRUD::field([
'name' => 'language_id',
'type' => 'relationship',
'entity' => 'language', // the method that defines the relationship in your Model
'label' => __('backpack.language'),
'hint' => __('backpack.create_group_language'),
]);
I've already checked all my relations, and they are working properly
What I expected to happen
On the update form / screen I was expecting to have the good ID selected in the relationship field.
If the field is : relationship, the first value of the select is selected, otherwise the good value is displayed
What happened
It is not working with the relationship field, but working with the select field. The field / value that is supposed to be selected is not the good one.
What I've already tried to fix it
Switching from relationship field to the select field.
CRUD::field([
'name' => 'language_id',
'type' => 'select',
'entity' => 'language', // the method that defines the relationship in your Model
'label' => __('backpack.language'),
'hint' => __('backpack.create_group_language'),
]);
Is it a bug in the latest version of Backpack?
After I run composer update backpack/crud the bug is still there.
Backpack, Laravel, PHP, DB version
When I run php artisan backpack:version the output is:
` ### PHP VERSION:
PHP 8.2.11 (cli) (built: Sep 26 2023 15:25:31) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.11, Copyright (c) Zend Technologies
Any chance you have a resources/views/vendor/backpack/pro/fields/relationship.blade.php custom in your app ?
I was about to ask you if you could reproduce it in our demo, and I noticed that in our demo the BelongsTo relationship was not properly working. I thought you were right, but in the end it was a mistake in our end.
We had two fields using the same relationship, so the value of one was overwriting the other.
I've fixed it in Laravel-Backpack/demo#581 and belongsTo relations seems to be working just fine, so I will add that you could check:
that you have not two fields for the same relationship.
that you have the language_id in your $fillable array in the model.
Bug report
What I did
I've created a CrudController and the UpdateOperation with a relationship field from a 1 <> n relation.
I've already checked all my relations, and they are working properly
What I expected to happen
On the update form / screen I was expecting to have the good ID selected in the relationship field.
If the field is : relationship, the first value of the select is selected, otherwise the good value is displayed
What happened
It is not working with the relationship field, but working with the select field. The field / value that is supposed to be selected is not the good one.
What I've already tried to fix it
Switching from relationship field to the select field.
Is it a bug in the latest version of Backpack?
After I run
composer update backpack/crud
the bug is still there.Backpack, Laravel, PHP, DB version
When I run
php artisan backpack:version
the output is:` ### PHP VERSION:
PHP 8.2.11 (cli) (built: Sep 26 2023 15:25:31) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.11, Copyright (c) Zend Technologies
LARAVEL VERSION:
10.33.0.0
BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.2
backpack/crud: 6.3.0
backpack/devtools: 2.0.3
backpack/generators: v4.0.2
backpack/logmanager: v5.0.1
backpack/permissionmanager: 7.1.1
backpack/pro: 2.0.18
backpack/theme-coreuiv2: 1.2.2
backpack/theme-coreuiv4: 1.1.1`
The text was updated successfully, but these errors were encountered: