How do I replace the default view with my widgets?
I have built (mostly) the 2 widgets that I want to display on my resource and they are looking fine. However, I am struggling to find in the documentation where I can hide the default view which for me, is the same wizard that is used to create a resource.
38 Replies
Can you provide some more information? When you say "hide the default view" do you mean that the only things you want displayed are the two widgets you've created?
In the AppPanelProvider you can config it with:
->widgets([ ])
and in here you manually register the widgets you want to show.
But it sounds like these are being displayed on a resource page, not the Dashboard
That is correct yes. So I have a 'Contact' resource. When I view the resource, I don't want to see the original form used to create contact, I want to see my 2 widgets only.
Correct, they auto-register on the dashboard
So use the above snippet
sorry, I didn't explain properly, this is not for the dashboard. it is for a resource I have created.
Sorry, do you have the widgets showing on both dashboard and resource?
let me grab a screen shot one moment
excuse the zoomed-out view, I needed to fit it all in.
I think you'll need a custom view to accomplish this
ah ok. I will take a look at the docs for custom views!
Oh thanks for the link!
and then add the widget to the view
If you want to keep the standard routing, you can create the custom page and then alter the 'view' route so that it directs to your custom page and not the standard one
but that's just personal preference
Awesome thank you so much! I will have a crack at it in the morning.
Coming back to this, I've set up a custom page and I've also added a custom theme to help with styling but when trying to render the widget I am getting the following
I did have it working initially but undone it as I couldn't get theming working and now I have, I managed to break this.
It could be because I published a custom layout in the first attempt? is there a way to undo this?
@livewire not @Livewire
oh bugger me
copilot got me
If I have the following Widget class
which previously allowed me to access the record within the blade component file, how do I do the same but for a custom page as $record is now null?
pass the record as a param to the lw component
ah ok, like
or maybe not, undefined variable.
['record' => $record]
still doesn't seem to like that for some reason
what error
Undefined variable $record
Here are my widgetssend your page class
sure 1 second.
so where is your record being stored
so it can be passed in
you need to extend ViewRecord
Previusly it was in the ContactResource like this:
That is how it worked before I needed the custom route.
yes
you need somewhere to actually store the contact
which ViewRecord will give you in the easiest way
Ok, I apprecaite your patience. This is a bit of a mindshift coming from React/Next apps
if you need an explanation, have a look at how livewire full page components work outside of filament
for sure its a shift, but its just a lack of knowledge with how Livewire works
nothing that cant be fixed
learning laravel and livewire and filament all at once 😅
i would learn laravel first so you understand how that works and what benefits filament provides
is the bootcamp enough for laravel would you say
I have a rough idea about it, mostly just been thrown in at the deepend haha
the livewire docs for full page components don't seem to mentioned storing data.
unless I am being blind.
they mention route parameters, right?
yeah, and it does show it for components but my class is a page, unless it is the 'same' with Livewire and actually a component.