I am trying to use socialite with lumen to login users to Facebook. I have set up the app and have been granted all permissions. I am following this article: https://appdividend.com/2017/07/12/laravel-facebook-login/
I am running the project on my site but when I call the /callback route, I am redirected to the Facebook login page and am then shown this error:
Error:
Class 'App\SocialFacebookAccount' not found
at /home/forge/saahil.favourup.com/app/Services/SocialFacebookAccountService.php:10
I assume the error is to do with nothing available to redirect to. In lumen, there is no php artisan make:model command and so my SocialFacebookAccountService has no where to store the user_id.
Is there any alternative or any way to make the model manually?
As you pointed out, the problem seems to be SocialFacebookAccount
is not found.
While there is no artisan make:model
command in Lumen, you can write the model by hand.
Just create a new file in app
folder with name SocialFacebookAccount.php
, then write its basic content:
<?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 = [];
}
That's basically what the artisan make model command does. With that base, you can continue following the steps you linked in your question.
Also, make sure you already have created the associated migration using: php artisan make:migration create_social_facebook_accounts_table