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
awcodes6mo ago
You can’t render anything in laravel without a route.
VortexTrumpetHat
VortexTrumpetHatOP6mo ago
Really? What about response()->view('some.blade')?
awcodes
awcodes6mo ago
That is rendering a view as a response that is based on the requests path.
VortexTrumpetHat
VortexTrumpetHatOP6mo ago
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
awcodes6mo 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
awcodes6mo 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
VortexTrumpetHatOP6mo ago
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
awcodes6mo 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
VortexTrumpetHatOP6mo ago
Okay, fair enough! How are SimplePage typically rendered if they don't implement Concerns\HasRoutes?
awcodes
awcodes6mo 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
VortexTrumpetHatOP6mo ago
If I create a SimplePage and perform route:list it doesn't show up? Thanks for this suggestion, I'll give it a try!
Want results from more Discord servers?
Add your server