jeroennoten / Laravel-AdminLTE

Easy AdminLTE integration with Laravel
MIT License
3.84k stars 1.08k forks source link

[QUESTION] Show side menu when not logged in, but not show when logged out #912

Closed PiousVenom closed 3 years ago

PiousVenom commented 3 years ago

Question

In my side menu, I've got options for Sign In and Register. This is fine, if not already logged in. But once logged in, I want to hide it. I'm using the can for other menu's, but I can't seem to get this particular functionality to work. Is there a way of making this happen?

PiousVenom commented 3 years ago

Never mind. I discovered listeners and was able to get it working.

dfsmania commented 3 years ago

@PiousVenom Why not use a login box, after login procedure you show the admin panel? We support customization of the legacy laravel/ui authentication scaffolding, check:

Laravel also offers other authentication scaffoldings, like breeze and jetstream, but we do not support views customization for these ones currently.

In my opinion, having a login link on the sidebar is not a good idea.

PiousVenom commented 3 years ago

@PiousVenom Why not use a login box, after login procedure you show the admin panel? We support customization of the legacy laravel/ui authentication scaffolding, check:

Laravel also offers other authentication scaffoldings, like breeze and jetstream, but we do not support views customization for these ones currently.

In my opinion, having a login link on the sidebar is not a good idea.

I have a welcome page that is displayed when no one is logged in. You suggest a login box on that then? I have the login view that was published when I did the only=auth_views. I'd thought just having a link to that in the sidebar would be sufficient.

dfsmania commented 3 years ago

@PiousVenom It is up to you, I prefer a login box by default when no one is authenticated. Then, on your routes, you can do something like next (assuming you have the authentication scaffolding):

//-----------------------------------------------------------------------------
// The next group of routes requires authentication. If the user is not
// authenticated, it will be redirected to the login screen.
//-----------------------------------------------------------------------------

Route::middleware('auth')->group(function()
{
    // TODO: Add here all routes that requires authentication.
});
PiousVenom commented 3 years ago

Yeah, I do that part already for the routes I want auth'd. Like I said though, just wanted to have a straight landing page with some stats displayed before they login. It's all good though. As I'd mentioned, I figured a way to do it, and it's working. Thanks. :)