Laravel 5 验证器
Laravel 5 Authenticator
我正在尝试实施社交名流,但我收到与身份验证器相关的错误 class。我的应用找不到它。
这是我控制器中的代码
<?php namespace App;
use Illuminate\Contracts\Auth\Authenticator;
use App\Repositories\UserRepository as UserRepository;
use Laravel\Socialite\Contracts\Factory as Socialite;
class AuthenticateUser {
private $users;
private $socialite;
private $auth;
public function __construct(UserRepository $users, Socialite $socialite, Authenticator $auth)
{
$this->users = $users;
$this->socialite = $socialite;
$this->auth = $auth;
}
public function execute($hasCode)
{
if ( ! $hasCode ) return $this->getAuthorisationFirst();
$user = $this->socialite->drivers('google')->user();
dd($user);
}
private function getAuthorisationFirst()
{
return $this->socialite->driver('google')->redirect();
}
}
我收到的错误是
Container.php 行 833 中的反射异常:Class Illuminate\Contracts\Auth\Authenticator 不存在
看来 laravel 5 认证器现在称为 Guard
The Authenticator was renamed to Guard. In the AuthenticateUser.php file rename 'use Illuminate\Contracts\Auth\Authenticator;' to 'use Illuminate\Contracts\Auth\Guard;' and don't forget to also change it in constructor function too" –
我正在尝试实施社交名流,但我收到与身份验证器相关的错误 class。我的应用找不到它。
这是我控制器中的代码
<?php namespace App;
use Illuminate\Contracts\Auth\Authenticator;
use App\Repositories\UserRepository as UserRepository;
use Laravel\Socialite\Contracts\Factory as Socialite;
class AuthenticateUser {
private $users;
private $socialite;
private $auth;
public function __construct(UserRepository $users, Socialite $socialite, Authenticator $auth)
{
$this->users = $users;
$this->socialite = $socialite;
$this->auth = $auth;
}
public function execute($hasCode)
{
if ( ! $hasCode ) return $this->getAuthorisationFirst();
$user = $this->socialite->drivers('google')->user();
dd($user);
}
private function getAuthorisationFirst()
{
return $this->socialite->driver('google')->redirect();
}
}
我收到的错误是
Container.php 行 833 中的反射异常:Class Illuminate\Contracts\Auth\Authenticator 不存在
看来 laravel 5 认证器现在称为 Guard
The Authenticator was renamed to Guard. In the AuthenticateUser.php file rename 'use Illuminate\Contracts\Auth\Authenticator;' to 'use Illuminate\Contracts\Auth\Guard;' and don't forget to also change it in constructor function too" –