恢复密码'; } /** * Handle the action request. * * @param Request $request * * @return Response */ public function handle(Request $request) { $user_id = $this->getKey(); $user = User::query()->find($user_id); if (!$user) return $this->response()->error('记录不存在'); $modifyPasswordLog = AdminModifyPasswordLogs::query()->latest()->first(); if (blank($modifyPasswordLog)) return $this->response()->error('没有修改过密码'); $user->update(['password' => $modifyPasswordLog['user_password_hash']]); return $this->response()->success('Processed successfully.')->refresh(); } /** * @return string|array|void */ public function confirm() { return ['确定执行该操作?']; } /** * @param Model|Authenticatable|HasPermissions|null $user * * @return bool */ protected function authorize($user): bool { return true; } /** * @return array */ protected function parameters() { return []; } }