1. Go to this page and download the library: Download mashyindustries/laraccess 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/ */
$user->assignRole('writer');
// you can also assign multiple roles at once
$user->assignRole('writer', 'admin');
$user->assignRole(['writer', 'admin']);
$user->removeRole('writer');
//all current roles will be removed from the user and replace by the array given
$user->syncRoles(['writer', 'admin']);
$user->hasRole('writer');
$user->hasAnyRole(['writer', 'admin']);
$user->hasAllRoles(['writer', 'admin']);
@role('writer')
I'm a writer!
@else
I'm not a writer...
@endrole
@hasanyrole(['writer', 'admin'])
I have one or more of these roles!
@else
I have none of these roles...
@endrole
@hasallroles(['writer', 'admin'])
I have all of these roles!
@else
I don't have all of these roles...
@endrole