/** * @param $command * * @return mixed */ public function execute($command) { if (isset($command->userId)) { \Cache::forget('user_capabilities_' . $command->userId); } if (isset($command->roleId)) { $role = Role::with('users')->findOrFail($command->roleId); foreach ($role->users as $user) { \Cache::forget('user_capabilities_' . $user->id); } } return true; }
/** * Return a single role model based on the given role id * * @param $roleId * @param array $with * * @return null */ public function getRole($roleId, $with = []) { return Role::with($with)->find($roleId); }