How to connect a Sentinel in Laravel 5.2?

How to write a grad to connect the authorization and authentication of Sentinel by default?
July 9th 19 at 10:54
1 answer
July 9th 19 at 10:56
Solution
You first need to create a service provider that propriarity Auth for example app/Providers/AdminServiceProvider.php
And there's the plugin class Sentinel
namespace App\Providers;

 use Auth;
 use Cartalyst\Sentinel\Sentinel;
 use Illuminate\Support\ServiceProvider;

 class AdminServiceProvider extends ServiceProvider
{
/**
 * Bootstrap the application services.
*
 * @return void
*/
public
 function boot()
{
 Auth::provider('our_provider', function($app, array $config) {

 return new Sentinel();
});
}

/**
 * Register the application services.
*
 * @return void
*/
public
 function register()
{
//
}
 }


Next you need to make changes to app/config/auth.php

'providers' => [
 'users' => [
 'driver' => 'our_provider',
],
],


After that everything works, of course you can create another provider and use it if you want Sentinel to use along with another method of authorization.
Made is just gorgeous and very comfortable. I'm in awe

Find more questions by tags Laravel