/** * Ł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; }
/** * 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(); }); }
/** * Przejście do artykułu */ public function onGoto($param = null) { if (isset($param) && ($post = Post::find($param))) { return $post->url; } }