/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * * @return mixed */ public function handle($request, Closure $next) { if ($this->auth->guest()) { if ($request->ajax() || $request->wantsJson()) { return response('Unauthorized.', 401); } else { $method = 'guest'; if ($request->method() === 'POST') { app('session')->put('url.intended', back_url()); $method = 'to'; } return redirect()->{$method}('auth/login')->withInfo(trans('gitamin.login.auth_prompt')); } } return $next($request); }
public function delete_place($id = null) { $id = (is_numeric($id) and $id > 0) ? intval($id) : 0; if (!$id) { show_404(); } $this->load->model('banners/models/Banner_place_model'); $this->Banner_place_model->delete($id); redirect(back_url('admin/banners/places_list/')); }
function create_dir() { global $cmd_data, $current_path; $cmd_data = iconv('UTF-8', 'GB2312', $current_path . $cmd_data); if (strlen($cmd_data)) { if (!file_exists($cmd_data)) { mkdir($cmd_data, 0755); $error_msg = 0; } else { $error_msg = '文件夹已存在。'; } } back_url($error_msg); }