DEV Community

loading...

Discussion on: ReactJS and Laravel - Running through a basic setup - Part 2

Collapse
devtalhaakbar profile image
Muhammad Talha Akbar Author

In your routes file, change this:
Route::get('/{path?}', function () {
return view('web');
});
to this:
Route::get('/{path?}', function () {
return view('web')->with('user', Auth::user());
})->where('path', '.*');

Collapse
lorcan profile image
Lorcan

Ok. Tried that, didn't seem to make any difference

Thread Thread
devtalhaakbar profile image
Muhammad Talha Akbar Author

Can you show exactly how your routes file look like? You might want to place Auth::routes(); in the /ajax block.

Thread Thread
lorcan profile image
Lorcan

routes/web.php -

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::group(['prefix' => 'ajax'], function() {
// all routes that don't need to go to react-router
Auth::routes();
});

Route::get('/{path?}', function () {
return view('web')->with('user', Auth::user());
})->where('path', '.*');