Custom button for a form
Hi, I created a custom button to create records in another way, the problem is that people who are not logged in can enter this path, how can I hide this path for people who are not logged in?
Solution:Jump to solution
But the route you showed is
/form-academic-component
not /dashboard/academic-components
?!17 Replies
that people who are not logged in can enter this pathFilament shouldn't allow access without a login by default.
Yes, the problem is that I define the path in
web
for the redirection to work.
There's your answers. If you register a separate path without authentication, then you don't get authentication.
Why do you need that for redirection? Just use the URL to the page?
Something like
AcademicComponentResource::getUrl('createform')
Excuse me, where should I place this code?
Where your redirect is
Forgive my ignorance, but from the resource FormAcademicComponent I am calling a custom view (filament.resources.academic-component-resource.pages.form-academic-component) for a save button, the problem is that I don't know where to define this path.
FormAcademicComponent
filament.resources.academic-component-resource.pages.form-academic-component:
Where do you use that public route
/form-academic-component
?It's right in the resources folder
And it is used to call the FormAcademicComponent.
I am talking about the route you registered. Not any view files. Where do you use that route?
You said, you registered the route "to make redirection work". Where do you need this?
Ahh ok, I use it in the save method for the save button.
This one? That's a different route though?
Yes, that's where I use it
Solution
But the route you showed is
/form-academic-component
not /dashboard/academic-components
?!Just remove the route from
web.php
. You shouldn't register Filament routes yourself.
Then use ::getUrl()
method of your resource in your redirect.I solved it, I did what you said, thank you very much for the help.