Exemplo n.º 1
0
 /**
  *  Index
  *  Find all Role.
  *
  *  @param  $payload
  *  @return boolean
  **/
 public function index($payload)
 {
     # Validate
     $userId = Guardian::userId();
     $user = User::find((int) $userId);
     $account = $user->accounts->first();
     Guardian::check($account->getId(), 'role:view');
     # return roles
     return Role::orderBy('id')->get()->map(function ($role) use($payload) {
         return $role->schema($payload->display);
     });
 }
Exemplo n.º 2
0
 /**
  *  Destroy
  *  Soft delete a Rolegroup.
  *
  *  @param  $payload
  *  @return boolean
  **/
 public function destroy($payload)
 {
     $userId = Guardian::userId();
     $user = User::find((int) $userId);
     $account = $user->accounts->first();
     Guardian::check($account->getId(), 'rolegroup:delete');
     $rolegroup = Rolegroup::find($payload->id);
     if (!$rolegroup) {
         throw new ModelNotFoundException();
     }
     # Soft Delete
     $rolegroup = Rolegroup::destroy($payload->id);
     return true;
 }