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
awcodes
awcodes4w ago
You can’t render anything in laravel without a route.
VortexTrumpetHat
Really? What about response()->view('some.blade')?
awcodes
awcodes4w ago
That is rendering a view as a response that is based on the requests path.
VortexTrumpetHat
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.
awcodes
awcodes4w ago
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.
awcodes
awcodes4w ago
But you might still have issues since filament’s view usually depend on specific layouts that might not be available in the exception handler.
VortexTrumpetHat
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.
awcodes
awcodes4w ago
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.
VortexTrumpetHat
Okay, fair enough! How are SimplePage typically rendered if they don't implement Concerns\HasRoutes?
awcodes
awcodes4w ago
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.
VortexTrumpetHat
If I create a SimplePage and perform route:list it doesn't show up? Thanks for this suggestion, I'll give it a try!