[英]Undefined class Socialite in Spark Laravel 5.4
我是Laravel和Spark的新手,試圖弄清楚我應該如何/在哪里添加我的新控制器並添加Socialite。
在我的提供者中我添加了
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;
時,我得到未定義的類use Socialite;
我嘗試過composer dump-autoload
和php artisan config:clear
但沒有任何工作。 難道我做錯了什么?
我正在使用Laravel 5.4和Socialite 3.0
謝謝!
php artisan clear-compiled
composer dump-autoload
php artisan optimize
這將清除當前編譯的文件,更新它所需的類,然后將它們寫回,這樣您就不必再這樣做了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.