/**
  * 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');
 }
示例#2
0
 /**
  * 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');
 }
示例#3
0
 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');
 }
示例#4
0
 private function createTag(TagRequest $request)
 {
     $tag = Tag::create($request->all());
     $this->syncVideos($tag, $request->input('video_list'));
     return $tag;
 }