PHP code example of shadowbane / authorization-module
1. Go to this page and download the library: Download shadowbane/authorization-module library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?phprequire_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
shadowbane / authorization-module example snippets
namespaceApp\Models;
useBackpack\CRUD\app\Models\Traits\CrudTrait; // <------------------------------- this oneuseSpatie\Permission\Traits\HasRoles;// <---------------------- and this oneuseIlluminate\Foundation\Auth\UserasAuthenticatable;
classUserextendsAuthenticatable{
useCrudTrait; // <----- thisuseHasRoles; // <------ and this/**
* Your User Model content
*/
bash
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"
php artisan migrate
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"// then First, add the Spatie\Permission\Traits\HasRoles trait to your User model(s)