duanfeng7756 2017-08-03 17:04
浏览 75

Spark Laravel 5.4中未定义的类社交名称

I'm new to Laravel and Spark trying to figure out how/where I should add my new Controllers and add Socialite.

In my providers I added

Laravel\Socialite\SocialiteServiceProvider::class,

In my aliases I added

'Socialite' => Laravel\Socialite\Facades\Socialite::class,

Here's what my app/HTTP/Controllers/Auth/LoginController class looks like

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;
    }
}

I get undefined class Socialite when I add use Socialite;

I tried composer dump-autoload and php artisan config:clear but nothing is working. Am I doing something wrong?

I'm using Laravel 5.4 and Socialite 3.0

Thanks!

  • 写回答

1条回答 默认 最新

  • dongwo8827523 2017-08-03 17:08
    关注
    php artisan clear-compiled 
    composer dump-autoload
    php artisan optimize
    

    This will clear the current compiled files, update the classes it needs and then write them back out so you don't have to do it again.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向