mardi 4 avril 2017

Calling Auth from outside laravel defaulting to file

My current site is slowly converting over to laravel.

When they log into the legacy site I also want to log them into laravel.

    require $_SERVER["DOCUMENT_ROOT"] . '/framework/bootstrap/autoload.php';
    $app = require_once $_SERVER["DOCUMENT_ROOT"] . '/framework/bootstrap/app.php';
    $kernel = $app->make('Illuminate\Contracts\Http\Kernel');

    $response = $kernel->handle(
      $request = \Illuminate\Http\Request::capture()
    );
    $id = $request->session()->getId();
    $user = new \myPackage\Models\MyUser;
    $user->fill( [$user->getKeyName() => $username] );
    \Illuminate\Support\Facades\Auth::guard( 'myGuard' )->login( $user ); 
    $request->session()->save();
    $loggedin = \Illuminate\Support\Facades\Auth::guard( 'myGuard' )->check();
    $kernel->terminate( $request, $response );

My issue is that my session driver seems to be flipping back to 'file' when it clearly should be 'database': 'driver' => env('SESSION_DRIVER', 'database'),

/Illuminate/Support/Manager.php:62: string(4) "file"

It seems like everything is working correctly except the type of session storage. Am I forgetting some boot method or missing an app setting?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire