How do you add sentinel to Laravel project?

909 views Asked by At

I have this method:

$user=Sentinel::findById($user->id);
$reminder=Reminder::exists($user)? : Reminder::create($user);
$this->sendEmail($user, $reminder->code);
return redirect()->back()->with(['success'=>'reset code sent']);

However it shows an error, Undefined type 'App\Http\Controllers\Security\Sentinel'

Does anyone know how to remove this error?

1

There are 1 answers

0
P. K. Tharindu On

After installing the package, open your Laravel config file located at config/app.php and add the following lines.

In the $providers array add the following service provider for this package.

Cartalyst\Sentinel\Laravel\SentinelServiceProvider::class,

In the $aliases array add the following facades for this package.

'Activation' => Cartalyst\Sentinel\Laravel\Facades\Activation::class,
'Reminder'   => Cartalyst\Sentinel\Laravel\Facades\Reminder::class,
'Sentinel'   => Cartalyst\Sentinel\Laravel\Facades\Sentinel::class,

Source: https://cartalyst.com/manual/sentinel/5.x#laravel-8