Php Spark Laravel 5.4中未定义的阶级社会名流
我是新来的Laravel和Spark,我想知道如何/在哪里添加我的新控制器和社交名流 在我的文章中,我添加了Php Spark Laravel 5.4中未定义的阶级社会名流,php,laravel-5.4,laravel-socialite,laravel-spark,Php,Laravel 5.4,Laravel Socialite,Laravel Spark,我是新来的Laravel和Spark,我想知道如何/在哪里添加我的新控制器和社交名流 在我的文章中,我添加了 Laravel\Socialite\SocialiteServiceProvider::class, 在我的别名中,我添加了 'Socialite' => Laravel\Socialite\Facades\Socialite::class, 下面是我的app/HTTP/Controllers/Auth/LoginController类的外观 namespace App\Htt
Laravel\Socialite\SocialiteServiceProvider::class,
在我的别名中,我添加了
'Socialite' => Laravel\Socialite\Facades\Socialite::class,
下面是我的app/HTTP/Controllers/Auth/LoginController类的外观
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Socialite;
class LoginController extends Controller
{
/*
|--------------------------------------------------------------------------
| Login Controller
|--------------------------------------------------------------------------
|
| This controller handles authenticating users for the application and
| redirecting them to your home screen. The controller uses a trait
| to conveniently provide its functionality to your applications.
|
*/
use AuthenticatesUsers;
/**
* Where to redirect users after login.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest')->except('logout');
}
/**
* Redirect the user to the GitHub authentication page.
*
* @return Response
*/
public function redirectToProvider()
{
return Socialite::with('github')->redirect();
}
/**
* Obtain the user information from GitHub.
*
* @return Response
*/
public function handleProviderCallback()
{
$user = Socialite::driver('github')->user();
// $user->token;
}
}
当我添加use Socialite时,我得到了未定义的类Socialite代码>
我尝试了composer dump autoload
和php-artisan-config:clear
,但没有任何效果。我做错什么了吗
我使用的是Laravel 5.4和Socialite 3.0
谢谢
php artisan clear-compiled
composer dump-autoload
php artisan optimize
这将清除当前编译的文件,更新所需的类,然后将它们写回,这样您就不必再做了。是否可以安全地假设您做了编写器需要laravel/socialite
步骤?并且使用laravel\socialite\Facades\socialite
是否会有所不同?是的,我重新安装了它,尝试改用use Laravel\Socialite\Facades\Socialite,现在我得到以下错误:在Laravel\Socialite\Facades\Socialite中找不到方法“with”;好的,这就是进度-它可以找到类。新错误是因为它应该是Socialite::driver('github')
,而不是Socialite::with('github')
代码>FacadeAccessor是facade中唯一可用的方法,但我应该能够使用其他函数,对吗?尝试了它,但仍然不起作用:/n我尝试使用的任何别名都无法识别它。尝试重新启动Phpstorm IDE,但似乎没有任何效果