Missing route parameter when editing resource
Hi all! Relatively new to Filament, coming from Nova.
I have a
Tenant
resource that spits out an error message when I try to edit them (Note, edit. Creation/deletion works fine).
It has 2 inputs, a name
(string) and a license_id
(select
, integer, refers to id
on licenses
table)
When ever I try to change anything in the resource, be it name or license, then it errors out with the following error message:
Looking through the trace, it seems to come from Livewires SupportBrowserHistory
feature> I've Googled around, but all the answers seems to be some of the more "obvious" once (like wrong parameter name in redirect
's etc.).
I haven't changed anything in the default Filament routing, and all other resources works correctly, it's only this one.
The primary
key type of Tenant
is a string
, and not and integer
- I don't know if this is relevant, but it's the only differing factor I can find.
I'm happy to supply any code you might want to check through, please let me know.13 Replies
Is your edit page is custom? if yes, then you probably need to put
mount($record)
. and yes, code will be helpfulthe edit page is the default one that gets generated with
php artisan make:filament-resource TenantResource --generate
:
Can you share TenantResource page, not edit
Sure, here:
It's weird, I also used "UUID" and I didn't have any error.. Sorry to hype up but I don't have any idea now.. at last which version you're using?
2.17.50
Thanks for trying though 🙂
It may not help but did you put
public $incrementing = false;
and protected $keyType = 'string';
in your model?I had not, no. I just added both, didn't change anything 😦
Hi, I have check and yet I don't have a problem, I'll show you what I did then you can have ref from there
in Database
in model
Form and Table, I used your code, but I didn't create relationship..
Here is video of what I mention above
Sorry about the delay, had lunch 🙂
So, testing a little further - if i add
id
to $fillable
on the Tenant
model, the error goes away and i get the notification that the settings has been saved!
However, the changes are not saved.
Also, looking through the request sent to Livewire when i click "save changed", i can see license_id
and license
. license_id
is unchanged from the database value, while license
has the new, updated value (this ofcourse won't get saved, since license
is not a column in my database). Is it possible, on a select
with relationship, to manually put in the column name?Forms\Components\Select::make('license_id')
?Yeah, that's what i ended up with. The
missing route parameter
was due to id
not being in the $fillable
array, so it got stripped from the request before livewire tried to solve the route.
However, the model is not getting saved now - I'll make a new thread for this. Thank your for helping out, marking as solved.