Render SimplePage without route?
Is it possible to render a SimplePage which does not have a route? For example, as a view response to an exception?
11 Replies
You can’t render anything in laravel without a route.
Really? What about
response()->view('some.blade')
?That is rendering a view as a response that is based on the requests path.
I didn't express my original question well enough... I have a
SimplePage
that I'd like to display if a particular exception is caught in middleware.
So there is a route for the original request.Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
But you might still have issues since filament’s view usually depend on specific layouts that might not be available in the exception handler.
Yep! I've been able to get that partially working , but the Filament
SimplePage
complains that $this
is being used outside object context when I attempt to render the view itself.
Is there a way to return something like response()->view(MySimplePage)
?
I guess it all boils down to wanting to display an error message using the styling of the rest of the Filament site. But <x-filament-panels::page.simple>
complains there's no context and I'm hoping I'm just missing something simple.Yea. Would make sense because it depends on livewire since it’s a full page component. And the laravel default exception views don’t use the app.blade.php layout.
Okay, fair enough! How are
SimplePage
typically rendered if they don't implement Concerns\HasRoutes
?You don’t really need the simple page though. You can just create your own simple page layout and include the filament theme.css.
They do have routes.
If I create a
SimplePage
and perform route:list
it doesn't show up?
Thanks for this suggestion, I'll give it a try!