1

I changed my Laravel file structure like this file structure.

I won't discuss how cause it's long but everything works fine and now if I want to access the Auth::user() or anything from Auth from the new Controllers, Views or Models locations it returns errors or null, and when i access the Auth from the routes/web.php it works fine so something in my new configuration is missing any ideas how to fix it? any file code is needed just ask me to put it, Thanks.

5
  • 1
    web.php has the web group of middleware applied from the RouteServiceProvider which provides sessions. Would need to see what you are actually doing. Commented Nov 2, 2017 at 0:45
  • Welcome to Stack Overflow! Please take the tour and edit your question to show the image directly instead of as a link. Please also show the errors you're getting, preferably as text. Commented Nov 2, 2017 at 0:46
  • am just dividing my application file structure into modules so each module has its own controllers models views file structure Commented Nov 2, 2017 at 0:47
  • sorry am just new here and am not allowed to put pictures directly...need more XPs Commented Nov 2, 2017 at 0:48
  • ok so from the User/Views/profile.blade.php if i access Auth::user() it returns null same with controllers Commented Nov 2, 2017 at 0:51

1 Answer 1

1

Thanx for the "hint" @lagbox gave me but i figured it out. i just needed to add the web middleware the the route in my User/routes.php like so:

Route::group(['prefix' => 'users', 'namespace' => 'App\Modules\User\Controllers'], function(){
    Route::get('/profile', ['as' => 'profile', 'uses' => 'UsersController@profile'])->middleware('web');
           );
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.