#Can't get correct URL when saving form

20 messages · Page 1 of 1 (latest)

warm shuttle
#

I'm trying to conditionally show a tab based on url name, I have a normal edit resource page with /edit endpoint and another page with custom endpoint that is using Edit Resource.

When I'm on /edit endpoint I want to hide some tab and when I'm on custom endpoint I want to show that tab, which works to certain point when it comes to only refreshing the page.

If I dump request in visible() method on normal refresh I get multiple "/livewire/update" in dump, but in DOM I can see it has "/app/1/profiles/7/edit" uri (which is okay when I'm simply loading the page, since it's working as intended).

However, when submitting the form and dumping request it's as if things break at DOM level and the tab simply gets shown. I also noticed when I change date in some input field the tab gets shown*.

I'm not sure if there's another way of doing this, I tried to store things into session but couldn't get it to work correct and it takes some work to manage storing correct values in session. It also seems as if visible() method gets called multiple times for some reason and makes it even more weird to store values into session, since it's firing multiple times for different things.

Not sure what to do here anymore, seems like it should be quite simple to implement this, but now it got a bit more complicated.

minor snowBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

plucky bluff
#

And when on that url hide it or make it visible

#

Depending on your case

warm shuttle
#

Trying to test this out but am having a different problem now:

I'm getting "Missing required parameter for [Route: filament.app.resources.profiles.edit] [URI: app/{tenant}/profiles/{record}/edit] [Missing parameter: record]." even though I'm passing $record in correctly and it's having proper values.

#

also tried $record->id

#

even if I manually put in value I keep getting this error.

#

Oh, just noticed I haven't correctly set array as second param in function, will try it out now.

warm shuttle
plucky bluff
#

I you just want the current url you can use Request::

warm shuttle
#

I also tried if I could somehow get current route name correctly since I'm on custom route, but to no success.

#

this returns

warm shuttle
#

Bump..

agile steeple
#

Ok so for a vie wor edit page you need to do:

ProfileResource::getUrl('edit', ['record' => $theModelRecord])