Forum

larave - how to lar...
 
Notifications
Clear all

larave - how to laralvel web.php router links to load component instead laravel page

1 Posty
1 Users
0 Reactions
288 Widok
0
Topic starter

example

1 Answer
0
Topic starter

open routes/web.php, and paste something simmilar.

//VUE ROUTER
Route::get('/{any}', function () {
    if (Auth::user()) {
        return view('user-welcome');
    } else {
        return view('guest-welcome');
    }
})->where('any', '(.*)');

 

no any link will always redirect to your user-welcome or guest-welcome view and load vue components, always

 

then add in same file prefix for API calls

Route::prefix('api')->group(function () {
    Route::resource('forms', FormsController::class);
    Route::resource('somethings', SomethingsController::class);
});
This post was modified 1 rok temu 2 times by mrmucha

Odpowiedź

Author Name

Author Email

Your question *

 
Preview 0 Revisions Saved
Share: