F
Filament15mo ago
Oumaima

undefined parmeter

Please I created a custom page and I redirect the user to the url of that page via and action /** Tables\Actions\ActionGroup::make([ Tables\Actions\Action::make('A4(x4)') ->url(fn (): string => route('filament.app.resources.delivery-notes.print-labels', ['number' => $number])), Tables\Actions\Action::make('A4(x6)'), Tables\Actions\Action::make('A4(x8)'), ]) */ but in the view of that page , the number parameter is Undefined
10 Replies
krekas
krekas15mo ago
how do you define route?
Oumaima
OumaimaOP15mo ago
lik this 'print-labels' => Pages\printLabels::route('/labels/{number}'),
krekas
krekas15mo ago
what you have in the mount method then?
Oumaima
OumaimaOP15mo ago
this is the page clss <?php namespace App\Filament\Resources\DeliveryNoteResource\Pages; use App\Filament\Resources\DeliveryNoteResource; use Filament\Resources\Pages\Page; class printLabels extends Page { protected static string $resource = DeliveryNoteResource::class; protected static string $view = 'filament.resources.delivery-note-resource.pages.print-labels'; }
krekas
krekas15mo ago
route model binding needs mount method check the livewire docs for this i think filament docs also has mentioned it otherwise your component doesn't know anything about $number
Oumaima
OumaimaOP15mo ago
I'm new to livewire , I don't know houw how and what I supposed to looking for
krekas
krekas15mo ago
it's a laravel thing not livewire and it's called route model binding
krekas
krekas15mo ago
Laravel
Components | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
krekas
krekas15mo ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
LeandroFerreira
LeandroFerreira15mo ago
['number' => $number] what is $number? The record?
Want results from more Discord servers?
Add your server