0

I'm working on custom modules in laravel and getting unable to access

print_r(Auth::user()); 

it show me blank.

my route is inside modules

Route::group(['module' => 'ScreenColors', 'middleware' => ['web'], 
   'namespace' => 'App\Modules\ScreenColors\Controllers'], 
    function() {
      Route::get('/screen_colors', 'ScreenColorsController@index');
    }
);

My modules directory is app\Modules\ScreenColors using ArtemSchander modules packages

How can I access auth details into modules controller? Thanks.

gil
  • 1,318
  • 12
  • 19
  • Have you edited your middleware or default middleware group? you must be sure that your route is encapsulated in the correct middleware to manage Auth: session for example. – Mtxz Aug 09 '18 at 12:52
  • no i have not edited my middleware can you let me know which kind of modification needed to get auth in modules controller? – viresh tripathi Aug 09 '18 at 12:59
  • where are you trying to call `Auth::user()` ... what file, the method? – lagbox Aug 09 '18 at 13:00
  • Could you post your 'web' group middleware list? In /app/http/Kernel.php. – Mtxz Aug 09 '18 at 13:03
  • 'web' => [ \App\Http\Middleware\EncryptCookies::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Session\Middleware\StartSession::class, // \Illuminate\Session\Middleware\AuthenticateSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class, \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, ], – viresh tripathi Aug 09 '18 at 13:14
  • @lagbox I am trying to call Auth::user() in ScreenColorsController inside modules controller file. 'namespace' => 'App\Modules\ScreenColors\Controllers' – viresh tripathi Aug 09 '18 at 13:15
  • have you tried to call it like this \Auth::user() – Znar Aug 09 '18 at 14:12

0 Answers0