The Docs show how to render full-page components.
Route::get('/example', Example::class);
Everything fine so far, but is it possible to do the same based on the role of the user, e.g.:
Route::get('/example', function() {
if (Auth::user()->hasRole('example'))
return Example::class;
...
// Return another component for another role
});
That doesn’t work of course, but you get the idea.
Note: Each of the components utilizes mount()
to do necessary initialization, so I can’t just call render()
.