Admin route not working in Twill 3.3 + Laravel 11
On fresh install of Laravel 10 everything works without any problem. On fresh install of Laravel 11 /admin route throws 404. Nothing changes after manually providing url in .env or twill.php. Seems to be Laravel 11 related.
7 Replies
Hi @Adam Mateusz Brożyński are you serving the 2 apps differently? And when you installed did you use a preset or not?
I noticed our basic-page-builder preset is conflicting with the root admin page because of the catch all route defined in the preset
This works:
composer create-project laravel/laravel:^10.0 laravel
cd laravel
composer require area17/twill:"^3.3"
php artisan twill:install basic-page-builder
[just set sqlite database in .env because it's not default like in laravel 11]
php artisan serve
This gives 404 when going to /admin:
composer create-project laravel/laravel twill-cms
cd laravel
composer require area17/twill:"^3.3"
php artisan twill:install basic-page-builder
php artisan serve
The only difference is Laravel version.
I've tested withoutbasic-page-builder
and route works. Also there's no mention about/admin
route inbasic-page-builder
README.md file on github and only: "go to your admin path, something like https://admin.laravel-twill.test" which is very missleading.
This is legacy because Twill 2 used to default to the admin subdomain. On Twill 3 it should indeed link to /admin in that readme, thanks for pointing it out.
As for the reason the basic-page-builder routing is an issue only with Laravel 11, I assume it's because the routes are not registered in the same order. Meaning twill routes are registered after your web.php routes in L11, and before in L10. We'll investigate further and may end up making it configurable if possible, because it isn't the first time we're running into route registration order conflicts between the package and the main app routes
Source of problem:
php artisan route:list
:
I don't know why "/" is at the top and "{slug}" is at the bottom of the list since both paths are defined in same file.
But when I do this then it works (partially because error 500 shows up on /admin when not logged in):
So basicaly after adding twill /admin route by hand it shows up the same in route:list but works differenty and not as expected because of error 500 when not logged in (/admin/login works but is not redirecting there).Hi! Is there any news on this?
I have a similar problem: Twill 3.3 & Laravel 11
set ADMIN_APP_PATH=/cmsadmin
mydomain.com/cmsadmin
-> 404 error
mydomain.com/cmsadmin/login
works, but all other links lead to 404
mydomain.com/cmsadmin/users
works, and all other links work as well
So far (until Laravel 11) it has worked well and I have not made any changes to twillHi @zlem we will prioritize this, sorry to hear. Do you also have a catch all route in your web.php (or any other routes files)?
@ifox yes, in web.php we have:
Route::get('/{slug?}', [PageController::class, 'showPage']);
Route::get('/', [PageController::class, 'showStartPage']);