2

I was about to recall the Authenticated user to my controller but suddenly it returns null. I don't have this problem in laravel 5. here's the code:

my web route:

Auth::routes();

Route::middleware('auth')->group(function () {

   ... 
      Route::prefix('api')->group(function () {
         Route::get('ticket', 'API\Ticket\TicketController');
      }
}

my controller:

use Illuminate\Support\Facades\Auth;
class TicketController extends Controller {
...
public function sampleMethod(){
    dd(Auth::user()); //returns null
  }
}

In laravel 5, it returns the model, even the relationship model. But in this case, it returns null.

btw I'm using laravel vue-auth scaffolding. What I'm missing here?

p.s: I it in NON API controller and it work. But why not in this api folder?

jp.palubs
  • 178
  • 1
  • 14

0 Answers0