问题描述
我正在尝试通过流明使用社交名流将用户登录到Facebook。我已经设置了应用程序,并被授予了所有权限。我正在关注这篇文章:https://appdividend.com/2017/07/12/laravel-facebook-login/
我正在网站上运行该项目,但是当我调用/ callback路由时,我被重定向到Facebook登录页面,然后显示此错误:
Error:
Class 'App\SocialFacebookAccount' not found
at /home/forge/saahil.favourup.com/app/Services/SocialFacebookAccountService.PHP:10
我认为该错误与重定向至无关。在流明中,没有PHP artisan make:model命令,因此我的SocialFacebookAccountService没有存储user_id的位置。
是否有其他方法或手动方式制作模型?
解决方法
如您所指出,问题似乎是SocialFacebookAccount
未找到。
流明中没有artisan make:model
命令,您可以手动编写模型。
只需在app
文件夹中创建一个名称为SocialFacebookAccount.php
的新文件,然后编写其基本内容:
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class SocialFacebookAccount extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [];
}
基本上,这就是工匠的make模型命令所做的。在此基础上,您可以继续执行在问题中链接的步骤。
此外,请确保您已经使用以下方法创建了关联的迁移:php artisan make:migration create_social_facebook_accounts_table