ResourceManager not using new field names. (QueryException)
I've created a CheckoutItemsRelationManager for my CheckoutSessionResource, when i view the panel it gives me the following error..
I've created a CheckoutItemsRelationManager for my CheckoutSessionResource, when i view the panel it gives me the above error..
The issue is I've changed checkout_session_id to stripe_checkout_id, but Filament is still trying to find it with its old variable name? any help would be appreciated.
I've updated the CheckoutItems.php reference to this variable & the migration for it. As well as clearing cache,config etc.
Solution:Jump to solution
Are you relying on Laravel's naming convention somewhere? If you have a relationship which implicitly uses that field name as the FK (so you didn't specify it in the relation function on the model), and you changed the field name without changing the table name, you would then have specify the FK name in the relationship function.
Like ...
```php...
4 Replies
What about the relationship, have you updated the model refs?
I've updated it everywhere else, the resource manager still looks for checkout_session_id, there is no reference to this anywhere in my project only stripe_checkout_id..
I'm wondering if there is a way to specifically override it with the new id or something
Solution
Are you relying on Laravel's naming convention somewhere? If you have a relationship which implicitly uses that field name as the FK (so you didn't specify it in the relation function on the model), and you changed the field name without changing the table name, you would then have specify the FK name in the relationship function.
Like ...
... which would implicitly look for a 'checkout_session_id' field as the FK. If you then changed that FK field name, without now specifying it in that $this->hasMany(), things would break.
Yeah so i was setup similar to that.
I've updated to this, which has fixed the previous error, I cannot however see the releated items still, it just says there are none, but I can verify they are setup correctly in the DB.