Following the directions at How to use laravel default authentication in backpack I made it so that Laravel Backpack would use Laravel Breeze's login page instead of it's own, however, once I'm in the Admin dashboard of Laravel Backpack (/admin/dashboard) the logout link (/admin/logout) gives a 404. I also see no reason to have Laravel Backpack link to it's own profile management page (/admin/edit-account-info) when it could just link back to Laravel Breeze's (/profile), however, I'm less concerned about that.
How can I make it so that instead of linking to /admin/logout it looks to Laravel Breeze's /logout?
Here's what php artisan backpack:version
returns:
### PHP VERSION:
PHP 8.1.2-1ubuntu2.14 (cli) (built: Aug 18 2023 11:41:11) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.14, Copyright (c), by Zend Technologies
### LARAVEL VERSION:
10.43.0.0
### BACKPACK PACKAGE VERSIONS:
backpack/basset: 1.2.4
backpack/crud: 6.6.5
backpack/generators: v4.0.3
backpack/pro: 2.1.8
backpack/theme-tabler: 1.2.5
Any ideas?
I got this working. Building off of Override CRUD views I copied ./vendor/backpack/theme-tabler/resources/views/inc/menu_user_dropdown.blade.php to ./resources/views/vendor/backpack/theme-tabler/inc/menu_user_dropdown.blade.php and then replaced this line:
<a href="{{ backpack_url('logout') }}" class="dropdown-item"><i class="la la-lock me-2"></i>{{ trans('backpack::base.logout') }}</a>
...with this:
<!-- Authentication -->
<form method="POST" action="{{ route('logout') }}">
@csrf
<a href="{{ route('logout') }}" class="dropdown-item"
onclick="event.preventDefault();
this.closest('form').submit();">
<i class="la la-lock me-2"></i>{{ trans('backpack::base.logout') }}
</a>
</form>
That was based off of ./resources/views/layouts/navigation.blade.php, which Laravel Breeze created.
https://backpackforlaravel.com/docs/6.x/base-themes#theme-view-fallbacks-1 talks about the order in which Laravel Backpack loads files.
Also, if your session times out (or if you explicitly logout of backpack in one page but not another) and then you try to reload a backpack page, you'll be redirected to /admin/login
, which'll give an error 404. To fix this I added the following to my routes/auth.php:
Route::get('/admin/login', function () {
return redirect('/login');
});