Closed Geezt435 closed 3 years ago
Hi @Geezt435 , what is <x-app-layout>
?? If you have defined your own layout blade-x component, please share it here so we can at least see that are you doing.
On the other hand, how you are managing the Authentication ? Laravel provides a few starter kits for it. However this packages only support replacement views for the old one laravel/ui, read:
Usually, you need to use one of the starter kits authentication scaffolding (or the old laravel/ui
with views replacement), and after the login procedure, you display the welcome view. Without authentication scaffolding, there is no way to have login/logout/register features unless you create your own views, controllers, etc.
Hello @Shidersz , thanks for the quick reply. <x-app-layout>
is the section for the standard Laravel code template on dashboard.blade.php, I haven't made my own layout blade-x component yet so I don't post the code here.
I look on the Wiki and there's only directing to /logout which when I tried doing:
<a src="localhost:8000/logout"> Log Out </a>
Makes out a 419 error or Form only can do POST actions.
Searching for another auth resolution in Laravel Docs, haven't found any solution either.
As for the logout features, it does seem I need to make my own controllers, etc, but I think it would be harder to do those rather than doing what provided by Laravel.
@Geezt435 I recommend to install one of the Authentication scaffolding provided by Laravel. They will take care of the views, controllers and routes for login, logout and register features. You can try the new Laravel-Breeze or the legacy laravel/ui for which this packages includes a set of replacement views with AdminLTE style.
@Geezt435 logging out in Laravel using a link is not supported by default (but see https://laravel.com/docs/8.x/authentication#logging-out on how to make it with a link). Instead you shall make a form like below.
<form method="POST" action="{{ route('logout') }}">
@csrf
<a href="{{ route('logout') }}"
onclick="event.preventDefault();
this.closest('form').submit();">
{{ __('Logout') }}
</a>
</form>
@Geezt435 If you need more help with this, open it again...
I'm currently a beginner at AdminLTE so I don't know how to do it myself. How to add the Laravel Logout form into a link in welcome.blade.php? I tried doing `
`
but it brings the whole layout instead of just a word "Log Out" and then makes the current user Logs Out of his account like in Dashboard.
I'm on Laravel 8 Latest AdminLTE (3.5.3) Help would be really appreciated :)