Beispiel #1
0
 public function readPost($request)
 {
     try {
         $post = $this->db->fetchOne(BlogPost::where('created')->between($from, $to)->and('slug')->equals($request->params['slug']));
     } catch (Minim_Model_Exception $e) {
         // 404
     }
     $this->render('post-read', array('title' => $post->title, 'content' => $post->content, 'created' => $post->created->format('d/m/Y \\a\\t H:i'), 'author' => $post->author));
 }
Beispiel #2
0
 /**
  * Tworzenie struktury związku
  * @param Post $post
  * @param Category $category
  * @param array $params dodatkowe parametry
  * @return Collection
  */
 public static function getStructure(Post $post, Category $category, array $params = [])
 {
     $structure = null;
     $categories = $category->getSubcategories(false, true);
     if ($categories) {
         $structure = Category::orderByRaw('"order" asc NULLS LAST')->find($categories)->filter(function ($elem) use($post) {
             if (empty($elem->communication) === false) {
                 $post = BlogPost::where('id', $elem->communication)->first();
                 $elem->communication = $post->getPaths();
             }
             $elem->posts = BlogPost::getPosts(['categories_id' => [$elem->id], 'template_id' => 2, 'additional' => ['person_type' => 3], 'order' => "additional->>'order' NULLS LAST"]);
             return $elem->posts->count() > 0;
         });
     }
     return $structure;
 }
Beispiel #3
0
 /**
  * Display the specified resource.
  *
  * @param  string  $slug
  * @return Response
  */
 public function show($slug)
 {
     if (is_null($blog_post = BlogPost::where('slug', $slug)->first())) {
         // Put a 404 in ur face, yo !
         return App::abort(404);
     }
     return View::make('modules.blog.posts.show', compact('blog_post'));
 }