public function postAdd() { if (!$this->checkRoute()) { return Redirect::route('index'); } $title = 'Add A Server Tag - ' . $this->site_name; $input = Input::only('name', 'deck', 'description', 'slug'); $messages = ['unique' => 'This server tag already exists in the database!']; $validator = Validator::make($input, ['name' => 'required|unique:server_tags', 'deck' => 'required'], $messages); if ($validator->fails()) { return Redirect::action('ServerTagController@getAdd')->withErrors($validator)->withInput(); } $server_tag = new ServerTag(); $server_tag->name = $input['name']; $server_tag->deck = $input['deck']; $server_tag->description = $input['description']; $server_tag->last_ip = Request::getClientIp(); if ($input['slug'] == '') { $slug = Str::slug($input['name']); } else { $slug = $input['slug']; } $server_tag->slug = $slug; $success = $server_tag->save(); if ($success) { //Cache::tags('modpacks')->flush(); //Queue::push('BuildCache'); return View::make('tags.server.add', ['title' => $title, 'success' => true]); } return Redirect::action('ServerTagController@getAdd')->withErrors(['message' => 'Unable to add modpack tag.'])->withInput(); }