I'm trying to run laravel web app and vuejs spa in the same laravel project.
How my web.php route config should be?
Route::get('/', function () {
return view('pages.landing.main');
})->name('home');
Route::get('/login', function () {
return view('pages.login');
})->name('login');
Route::get('/product', function () {
return view('pages.product.detail');
});
Route::get('/admin/{any}', function () {
return view('layouts.app');
})->where('any', '.*');
This is what I'm trying to.
What I get :
- When I try to reach /admin it shows me the blade 404 not found page.
- When I try to reach /admin/some-url it shows me the Vuejs app 404 not found page that I built, my Vuejs app routes not working as well.
Currently I'm building another project with only laravel api + vuejs this code works.
Route::get('{any}', function () {
return view('layouts.app');
})->where('any', '.*');