1. Go to this page and download the library: Download digbang/security library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App\Providers;
use Digbang\Security\SecurityContext;
use Digbang\Security\Configurations\SecurityContextConfiguration;
class MyServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function boot(SecurityContext $securityContext)
{
$configuration = new SecurityContextConfiguration('ecommerce');
// customize the configuration object as needed...
$securityContext->add($configuration);
}
}
$router->group(['middleware' => 'security:ecommerce'], function(Router $router){
// Controllers inside this routing group will be able to ask for an instance
// of the Digbang\Security\Contracts\SecurityApi interface.
$router->get('/', ['as' => 'foo', 'uses' => 'FooController@index']);
});