F
Filamentβ€’3mo ago
Mexata

Directing to a form in a resource from a widget in my dashboard

I got this widget in my dashboard:
<div class="col-md-6">
<x-filament::button
icon="heroicon-m-arrow-right"
icon-position="after"
href="???"
tag="a"
>
Add
</x-filament::button>
</div>
<div class="col-md-6">
<x-filament::button
icon="heroicon-m-arrow-right"
icon-position="after"
href="???"
tag="a"
>
Add
</x-filament::button>
</div>
and it has to direct to a: public static function form(Form $form): Form (inside a Resource) How do I make this work?
15 Replies
Tally
Tallyβ€’3mo ago
if you run the php artisan route:list option you can see which routes are available for you if you for example have a UserResource in a Admin panel.. the route would be filament.admin.resources.users.index for the index page or .create for the create page then just use
route('filament.admin.resources.users.create')
route('filament.admin.resources.users.create')
in your href πŸ™‚
Mexata
Mexataβ€’3mo ago
i have tried this, but there is no route to the actual form, the best it has is a route to the resource it self:
No description
Tally
Tallyβ€’3mo ago
the "new site" opens a modal?
Mexata
Mexataβ€’3mo ago
yes that opens a form and that is what i want to show
Tally
Tallyβ€’3mo ago
is there a create entry in your getPages function in the Resource?
Mexata
Mexataβ€’3mo ago
there is not no
Tally
Tallyβ€’3mo ago
aaaah that's probably the issue then
Mexata
Mexataβ€’3mo ago
so if i would create an create entry in the getpages it would show a route in the route:list right? is it possible to not do that and actually go from the widget to the form
Mexata
Mexataβ€’3mo ago
the "new site" opens a model simillair to this
No description
Mexata
Mexataβ€’3mo ago
is it possible to when i press my button in my widget to open it like this
Tally
Tallyβ€’3mo ago
I'm not completely sure... I think the modal is in the ListResource yes I understand... don't think the modal is available on your dashboard page maybe there is a "secret" link to go to the .index page and open the create modal?
Mexata
Mexataβ€’3mo ago
alright will keep on looking or maybe some hopps in the chat thank you tho
Tally
Tallyβ€’3mo ago
If i find something I'll paste it here πŸ˜‰
awcodes
awcodesβ€’3mo ago
basically, since there is no page or route, you will need to grab the resource, new it up and create a new action that can use the details from the resource to open the modal with the form. See here for how i'm doing it. https://github.com/awcodes/filament-quick-create/blob/3.x/src/Components/QuickCreateMenu.php
GitHub
filament-quick-create/src/Components/QuickCreateMenu.php at 3.x Β· a...
Plugin for Filament Panels that adds a dropdown menu to the header to quickly create new items. - awcodes/filament-quick-create
Tally
Tallyβ€’3mo ago
Wow that's next level πŸ˜‰ nice!!