0

As I've seen in many tutorials, I used the following code to be able to use the vue-router:

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/{any}', function () {
    return view('home');
})->where('any', '.*');

I'm using sanctum and I would like to keep using the Auth::routes() that comes with laravel, but they don't work anymore.

I guess I have to change the {any} pattern with something else, but with what exactly?

Best

1
  • hm I am under the assumption that you should define the more specific routes first, which is what you did. Try php artisan route:list and see what it says. Commented May 24, 2020 at 12:43

1 Answer 1

1

Ok, so I decided to simply route everything after /app via Vue, the rest will go through laravel.

I went to app->providers->RouteServiceProvider.php and updated the following line as:

public const HOME = '/app/home';

The routing would look like this in Laravel (mention the 'app'):

Route::get('/', function () {
    return view('welcome');
});

Auth::routes();

Route::get('/app/{any}', function () {
    return view('app');
})->where('any', '.*');

If someone has a better workaround, please let me know!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.