public function index() { $blogPostsCount = $this->post->criteria(new PostType('blog'))->count(); $workPostsCount = $this->post->criteria(new PostType('work'))->count(); $usersCount = $this->user->count(); return view('backend.dashboard.index', compact('blogPostsCount', 'workPostsCount', 'usersCount')); }
/** * Execute the job. * * @return void */ public function handle() { // Image Handling if (isset($this->data['image'])) { $this->data['image'] = $this->buildImage(); } // We create the Post if ($this->id === null) { $this->data['author_id'] = Auth::id(); $this->repository->create($this->data); } else { $this->repository->update($this->id, $this->data); } }
/** * Display the specified resource. * * @param string $slug * * @return \Illuminate\View\View */ public function show($slug) { $work = $this->repository->findBy('slug', $slug); $works = $this->repository->all(); return view('frontend.pages.works.show', compact('work', 'works')); }
/** * Bind data to the view. * * @param View $view */ public function compose(View $view) { $posts = $this->repository->criteria(new PostType('blog'))->criteria(new LastFive())->all(); $view->with('lastPosts', $posts); }
/** * Display the specified resource. * * @param string $slug * * @return \Illuminate\View\View */ public function show($slug) { $work = $this->repository->findBy('slug', $slug); $works = $this->repository->fetch(1, 30, ['*'], [], ['id' => 'DESC']); return view('frontend.pages.works.show', compact('work', 'works')); }
/** * Display the specified resource. * * @param string $slug * * @return \Illuminate\View\View */ public function show($slug) { $post = $this->post->findBy('slug', $slug); return view('frontend.pages.blog.show', compact('post')); }
/** * Remove the specified resource from storage. * * @param int $id * * @return \Illuminate\Http\RedirectResponse */ public function destroy($id) { $this->repository->delete($id); return redirect()->route('admin.posts.index'); }
/** * Home Page. * * @return \Illuminate\View\View */ public function home() { $works = PostsRepository::instance()->fetch(1, 30, ['*'], [], ['id' => 'DESC']); return view('frontend.pages.home', compact('works')); }
/** * Home Page. * * @return \Illuminate\View\View */ public function home() { $works = PostsRepository::instance()->all(); return view('frontend.pages.home', compact('works')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $post = Post::findOrFail($id); $post->destroy(); return redirect('posts'); }