Aha... I have added the following code to these:
AuthSP:
public function boot()
{
$this->registerPolicies();
// Implicitly grant "Super Admin" role all permissions
// This works in the app by using gate-related functions like auth()->user->can() and @can()
Gate::before(function ($user, $ability){
return $user->hasRole('Super Admin') ? true : null;
});
//Superadmin check
Gate::define('isSuperAdmin', function($user){
return $user->hasRole('Super Admin');
});
//PLT Student check
Gate::define('isPLTStudent', function($user){
return $user->hasRole('PLT Student');
});
//Student check
Gate::define('isStudent', function($user){
return $user->hasRole('Student');
});
//Logged in?
Gate::define('logged-in', function($user){
return Auth::user();
});
//SEE Admin Panel
Gate::define('SEE-admin-panel', function($user){
return $user->hasAnyRoles(['PLT Student']);
});
//SEE Admin Dashboard
Gate::define('SEE-admin-dashboard', function($user){
return $user->hasAnyRoles(['PLT Student']);
});
//USERS PERMISSIONS
//Overall
Gate::define('USERS-manage-users', function($user){
return $user->hasAnyRoles(['PLT Student']);
});
//Specific
Gate::define('USERS-create-users', function($user){
return $user->hasRole('PLT Student');
});
Gate::define('USERS-view-users', function($user){
return $user->hasRole('PLT Student');
});
Gate::define('USERS-edit-users', function($user){
return $user->hasRole('PLT Student');
});
Gate::define('USERS-delete-users', function($user){
return $user->hasRole('PLT Student');
});
//RUNS PERMISSIONS
//Overall
Gate::define('RUNS-manage-runs', function($user){
return $user->hasAnyRoles(['PLT Student']);
});
//Specific
Gate::define('RUNS-create-runs', function($user){
return $user->hasRole('PLT Student');
});
Gate::define('RUNS-view-runs', function($user){
return $user->hasAnyRoles(['PLT Student', 'Student']);
});
Gate::define('RUNS-edit-runs', function($user){
return $user->hasRole('PLT Student');
});
Gate::define('RUNS-delete-runs', function($user){
return $user->hasRole('PLT Student');
});
Gate::define('RUNS-delete-runs', function($user){
return $user->hasRole('PLT Student');
});
//RUNTYPES PERMISSIONS
//Overall
Gate::define('RUNTYPES-manage', function($user){
//return $user->hasAnyRoles(['PLT Student']);
});
//Overall
Gate::define('RUNTYPES-view', function($user){
return $user->hasAnyRoles(['PLT Student', 'Student']);
});
//RUNTYPES PERMISSIONS
//Overall
Gate::define('GROUP-manage', function($user){
//return $user->hasAnyRoles(['PLT Student']);
});
}
AppSP:
public function boot()
{
View::share('run_types', RunType::orderBy('name')->get()); //share with all
}