Пример #1
0
 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'));
 }
Пример #2
0
 /**
  * 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);
     }
 }
Пример #3
0
 /**
  * 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'));
 }
Пример #4
0
 /**
  * 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);
 }
Пример #5
0
 /**
  * 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'));
 }
Пример #6
0
 /**
  * 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'));
 }
Пример #7
0
 /**
  * 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');
 }
Пример #8
0
 /**
  * Home Page.
  *
  * @return \Illuminate\View\View
  */
 public function home()
 {
     $works = PostsRepository::instance()->fetch(1, 30, ['*'], [], ['id' => 'DESC']);
     return view('frontend.pages.home', compact('works'));
 }
Пример #9
0
 /**
  * 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');
 }