Package for Laravel Logout
npm install laravel-logout
This package need X-CSRF-TOKEN, add this code to your header template
<meta name="csrf-token" content="{{ csrf_token() }}">
In your app.js, add this code
require('laravel-logout');
In your blade template
<a laravel-logout>Logout</a>
The default logout url use logout route from laravel ('/logout'). If you have different logout url, use data-action attribute
<a laravel-logout data-action="your-logout-url">Logout</a>