0

I'm working on a Laravel/Craft integration project, where I have to check if a user is authenticated on a Laravel app running on the same site. So far, I've managed to load Laravel inside a plugin controller using:

require $path_to_laravel . '/laravel/vendor/autoload.php';
$app = require_once $path_to_laravel . '/laravel/bootstrap/app.php';

$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$request = \Illuminate\Http\Request::capture();
$kernel->handle($request);

And it runs without errors, but calling Auth::user() always returns null. But the same code in a standalone .php file returns the current user! What is happening? Maybe Craft is manipulating the request somehow?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.