public function getTagPost($id = null)
 {
     $tag = Tags::findOrFail($id);
     $page_title = $tag->name;
     $posts = $tag->posts()->where('active', 1)->orderBy('updated_at', 'desc')->paginate($this->per_page);
     $data = compact('posts', 'page_title');
     return view('posts.page', $data);
 }
Esempio n. 2
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $tag = Tags::findOrFail($id);
     if ($tag->delete()) {
         \Flash::success('Tag deleted');
     } else {
         \Flash::error('Error');
     }
     return 'done';
 }