How do I correctly create a link to a record from another view?
I has various pages within the app I am building where I am displaying a list of items based on data being passed in.
what I haven't been able to find in the docs yet though is how I can correctly link to one of the items being rendered so that it either navigates to the record view or opens up the view modal.
Here is some example code with the todo comment being where I would like to action the link from
Apologies if this is an easy find, I struggled to do so and I couldn't find a similar thread in the forumn already.
Solution:Jump to solution
Turns out, it was in the docs all along and I was being stupid! I think I need this:
```php
se App\Filament\Resources\CustomerResource;
<x-filament::button tag="a" href="{{...
8 Replies
all pages can be accessed from the resource
MyResource::getUrl('edit or view or any other page',['record=>1']);
Ah nice!
So for both of the resources I am trying to link to at the moment, they use a modal and a wizard for the create / edit actions so there is not a dedicated page.
Does this have to change or is there a way to action the modals?
ya I dont think so
the modals and it's actions lives in the resource
maybe you could refactor that, extract the action and reuse it as an action in other places
Interesting, thank you Lara, I will have a look and a play.
Solution
Turns out, it was in the docs all along and I was being stupid! I think I need this:
Will come back and confirm.
So creating a new record works correctly but when I try and edit a record, it doesn't open the modal, here is the code for the edit
I have updated the first example to match my code.
If I try the table version
It navigates to the products but it does not open the edit modal.
The URL very quickly flashes to, from
http://localhost:8080/stock-products?tableAction=edit&tableActionRecord=1
to just http://localhost:8080/stock-products
Not sure but a thought would be to include the filament-modals blade?
oh okay, so add
<x-filament::modal />
to the blade file? syntax is likely wrong there, I was guessing.
This didn't seem to do the trick.
I fixed it. Need to have the table action present in the actions array.