我试图通过以下方式检查会话:
<?php
namespace AndyJessop\Socialist\Http\Controllers;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Auth\Guard;
use AndyJessop\Socialist\AuthenticateUser;
class AuthController extends Controller {
public $auth;
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
public function login($provider, AuthenticateUser $authenticateUser, Request $request)
{
$user = $authenticateUser->execute($request->has('code'), $provider);
return $user;
}
public function logout()
{
$this->auth->logout();
return response()->json(['You have been logged out']);
}
public function checkSession()
{
$session = $this->auth->check();
return $session;
}
}
但我收到错误:Uninitialized string offset: 0
这可能是什么原因?
答案 0 :(得分:0)
检查数据库表并查看记录。我认为你没有记录。