middleware('auth'); // 验证登录 } // Admin response redirect protected function response($msg = self::SUCCESS_MSG, $status = 'success', $callback = '', $redirect = '', array $data = []) { $request = request(); if ($request->wantsJson() || $request->ajax()) { if ($status == 'success' && empty($redirect)) { $redirect = ''; } return response()->json([ 'status' => $status, 'message' => $msg, 'redirect' => $redirect, 'callback' => $callback, 'data' => $data ]); } else { return redirect()->back()->withErrors($msg)->withInput(); } } }