Ejemplo n.º 1
0
 /**
  * Ładowanie podglądu artykułu
  * @return Post
  */
 protected function loadPreview()
 {
     $post = null;
     if ($this->property('pageId') && Cache::has('preview' . $this->property('pageId'))) {
         $data = Cache::get('preview' . $this->property('pageId'));
         if ($post = BlogPost::find((int) $this->property('pageId'))) {
             foreach ($data as $key => $value) {
                 $post->{$key} = $value;
             }
             $post->categories_id = $this->categoryPage = $post->categories->id;
             $this->category = $post->categories;
         }
     }
     return $post;
 }
Ejemplo n.º 2
0
 /**
  * Generowanie urli do artykułów w kolejce
  * @return void
  */
 public static function queueUrls(array $ids)
 {
     \Queue::push(function ($job) use($ids) {
         Post::find($ids)->each(function ($post) {
             $post->generateUrl();
         });
         $job->delete();
     });
 }
Ejemplo n.º 3
0
 /**
  * Przejście do artykułu
  */
 public function onGoto($param = null)
 {
     if (isset($param) && ($post = Post::find($param))) {
         return $post->url;
     }
 }