1. Go to this page and download the library: Download laravel-commode/resolver 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\System\Security\Abstractions;
interface ISecurityUser
{
public function hasPermission($permission);
public function hasPermissions(array $permissions);
}
namespace App\DAL\Concrete\Eloquent\Models;
use Illuminate\Database\Eloquent\Model;
class Account extends Model implements ISecurityUser
{
/* your eloquent model code */
}
namespace App\ServiceProviders;
use LaravelCommode\SilentService\SilentService;
use MyApp\System\Security\Abstractions\ISecurityUser;
class ACLServiceProvider extends SilentService
{
public function launching() {}
public function registering()
{
$this->app->bind(ISecurityUser::class, function ($app)
{
return app('auth')->user(); // note that returned value might be null
});
}
}