/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(TagRequest $request, $id) { $tag = Tag::findOrFail($id); $attributes = $request->all(); if ($tag->slug != str_slug($request->input('name'))) { $slug = $this->getSlug($request->input('name'), false); if ($slug == false) { flash()->error('You need a different name!'); return redirect('admin/tags/' . $id . '/edit'); } $attributes['slug'] = $slug; } $tag->update($attributes); return redirect('admin/tags'); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param Tag $tag * @return \Illuminate\Http\Response */ public function update(TagRequest $request, Tag $tag) { if (is_null($request->input('navigation'))) { $request->request->add(['navigation' => 0]); } $tag->update($request->all()); session()->flash('flash_message', 'Se ha actualizado el nombre de la etiqueta'); return redirect('admin/tags'); }
public function store(TagRequest $request) { //$this->createTags($request); $tag = new Tag(); $tag->name = $request->input('name'); $tag->save(); \Session::flash('flash_message', 'Tag has been added!'); return redirect('tags'); }
private function createTag(TagRequest $request) { $tag = Tag::create($request->all()); $this->syncVideos($tag, $request->input('video_list')); return $tag; }