예제 #1
0
 /**
  * @param int $id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function edit($id)
 {
     $category = Category::with('tags', 'media')->findOrFail($id);
     $categories = Category::all('id', 'name');
     $tags = Tag::all('id', 'name');
     return view('admin::categories.edit', compact('category', 'categories', 'tags'));
 }
예제 #2
0
 /**
  * Display the specified resource.
  *
  * @param string $tag_slug
  * @return \Illuminate\Http\Response
  */
 public function show($tag_slug)
 {
     $tag = Tag::getBySlug($tag_slug);
     $posts = Post::whereHas('tags', function ($query) use($tag_slug) {
         $query->where('slug', $tag_slug);
     })->simplePaginate(10);
     return view('flashtag::tags.show', compact('tag', 'posts'));
 }
예제 #3
0
 public function home()
 {
     $mostViewed = Post::mostViewed(5)->get();
     $leastViewed = Post::leastViewed(5)->get();
     $postCount = Post::count();
     $categoryCount = Category::count();
     $tagCount = Tag::count();
     $pageCount = Page::count();
     return view('admin::home', compact('mostViewed', 'leastViewed', 'mostViews', 'leastViews', 'postCount', 'categoryCount', 'tagCount', 'pageCount'));
 }
예제 #4
0
 public function edit($id)
 {
     $post = Post::with('author', 'fields', 'category', 'tags')->findOrFail($id);
     $post->lock(auth()->user()->id);
     $categories = Category::all(['id', 'name']);
     $tags = Tag::all(['id', 'name']);
     $authors = Author::all(['id', 'name']);
     $fields = Field::all();
     return view('admin::posts.edit', compact('post', 'categories', 'tags', 'authors', 'fields'));
 }
예제 #5
0
 /**
  * Remove the specified tag from storage.
  *
  * @param  int $id
  * @return \Dingo\Api\Http\Response
  */
 public function destroy($id)
 {
     $tag = $this->tag->findOrFail($id);
     $tag->delete();
     return $this->response->item($tag, new TagTransformer());
 }
예제 #6
0
 /**
  * @param TagDestroyRequest $request
  * @param int $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function destroy(TagDestroyRequest $request, $id)
 {
     $tag = Tag::findOrFail($id);
     $tag->delete();
     return redirect()->route('admin::tags.index');
 }
예제 #7
0
 /**
  * @param int $id
  */
 public function destroy($id)
 {
     $field = Tag::findOrFail($id);
     $field->delete();
 }