本文介绍了找不到Laravel Class Socialite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了什么:

  • "laravel/socialite": "~2.0"添加到composer.json
  • 运行composer update
  • 已将提供商'Laravel\Socialite\SocialiteServiceProvider'添加到app.php
  • app.php
  • 添加了别名'Socialite' => 'Laravel\Socialite\Facades\Socialite'
  • Added "laravel/socialite": "~2.0" to composer.json
  • Run composer update
  • Added provider 'Laravel\Socialite\SocialiteServiceProvider' to app.php
  • Added alias 'Socialite' => 'Laravel\Socialite\Facades\Socialite' to app.php

完成所有这些步骤后,我创建了一个新的Controller类,如下所示:

After all this steps I created a new Controller Class which looks like that:

<?php namespace App\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;

use Illuminate\Http\Request;

class AuthController extends Controller {

    public function login()
    {
        return \Socialite::with('facebook')->redirect();
    }

}

但是,我仍然收到此错误:PHP Fatal error: Class '\Socialite'

But i still got this error: PHP Fatal error: Class '\Socialite'

修改
composer dump-autoload可能修复了该错误,但仍无法正常工作.

Edit
composer dump-autoload fixed probably the error, but it's still not working correctly.

推荐答案

在控制器中use Illuminate\Http\Request;以下,添加use Socialize;

Just below use Illuminate\Http\Request; in your controller add use Socialize;

这篇关于找不到Laravel Class Socialite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 16:12