Problems with Modelbinding
Hey - I ain't sure if this is a Livewire, Laravel, or Filament-thing, but hopefully this thing is common enough so someone has an idea...
I am trying to pass data from one form-page to the next. What I did so far is to build the submit-method on the first page like this:
return redirect(Detailselection::getUrl(['article' => $this->article]));
and altered the mount-method on the Detailselection-Page like this:
now when I add a dd($article)
to the mount-method, I get an empty TypedArticle-model-instance, even tho the URL looks like this: .../detailselection?article=2
(which should load the TypedArticle-Model with ID 2).
What am I missing here?6 Replies
public TypedArticle $article
, you shouldnt need to have a parameter on mount()I thought so aswell, but removing it results in
Typed property App\Filament\Pages\...\Detailselection::$article must not be accessed before initialization
oh
i know why
article is not a url parameter, its a query parameter
if you want to use a query parameter, you need to TypedArticle::find(request()->query('article'))
Ah okay - and how would I pass it as an URL-Parameter? Cause I did what was posted at https://laravel-livewire.com/docs/2.x/rendering-components#parameters but the $article-Parameter inside the mount-function is empty (as stated).
Livewire
Rendering Components | Livewire
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
on the Detailselection class,
$slug = 'detailselection/{article}'
Best man! Thank you! π