/** * @return \Illuminate\View\View */ public function disableSelected(Request $request) { $chkUsers = $request->input('chkUser'); Audit::log(Auth::user()->id, trans('admin/users/general.audit-log.category'), trans('admin/users/general.audit-log.msg-disabled-selected'), $chkUsers); if (isset($chkUsers)) { foreach ($chkUsers as $user_id) { $user = $this->user->find($user_id); if (!$user->canBeDisabled()) { Flash::error(trans('admin/users/general.error.cant-be-disabled')); } else { $user->enabled = false; $user->save(); } } Flash::success(trans('admin/users/general.status.global-disabled')); } else { Flash::warning(trans('admin/users/general.status.no-user-selected')); } return redirect('/admin/users'); }
/** * @return \Illuminate\View\View */ public function disableSelected(Request $request) { //TODO: Should we protect 'admins', 'users'?? $chkRoles = $request->input('chkRole'); Audit::log(Auth::user()->id, trans('admin/roles/general.audit-log.category'), trans('admin/roles/general.audit-log.msg-disabled-selected'), $chkRoles); if (isset($chkRoles)) { foreach ($chkRoles as $role_id) { $role = $this->role->find($role_id); $role->enabled = false; $role->save(); } Flash::success(trans('admin/roles/general.status.global-disabled')); } else { Flash::warning(trans('admin/roles/general.status.no-role-selected')); } return redirect('/admin/roles'); }
/** * @return \Illuminate\View\View */ public function disableSelected(Request $request) { //TODO: Should we protect 'basic-authenticated', 'guest-only', 'open-to-all'?? $chkPerms = $request->input('chkPerm'); Audit::log(Auth::user()->id, trans('admin/permissions/general.audit-log.category'), trans('admin/permissions/general.audit-log.msg-disabled-selected'), $chkPerms); if (isset($chkPerms)) { foreach ($chkPerms as $perm_id) { $permission = $this->permission->find($perm_id); $permission->enabled = false; $permission->save(); } Flash::success(trans('admin/permissions/general.status.global-disabled')); } else { Flash::warning(trans('admin/permissions/general.status.no-perm-selected')); } return redirect('/admin/permissions'); }