record of custom page to widget
How to access $record in widget while widget is registered in custom pages
13 Replies
this is my widget class
Edit blade file like this
<x-filament::page :widget-data="['key' => $value]">
getting error for this
Undefined variable $record
this is my blade file
<x-filament::page :widget-data="['record' => $record]">
</x-filament::page>
what is $record contain from custom page, not widget?
i am getting record if i am registering widget in editpage ...if i registered my widget in custom page i am getting record null
this is my custom class
Yes, edit and view page contain data, but you are in custom page.. unless you define what you need in
$variable
you cannot get.. create $record in custom page and you can see what is happening in the blade filehow to declare $record in custom page
you can have an idea from here
thanks
i got record from url is there any better way
First explain what you want to pass in widget.. The
ID
or whole Model?
$this->record = WpTerm::whereTermId($record)->first(); check what is $record inside mount()http://127.0.0.1:8000/admin/category-page-handler/6336/manage
this is my url i am passing $record as 6336 from current url
Do like what I written there, $record contain 6336 inside mount()..
like this
yes