private function createArticle($model) { $model = Article::create($model); return $model; }
protected function loadNext($currentPost) { $parts = explode(' ', $this->property('sortOrder')); list($sortField, $sortDirection) = $parts; $comparator = $sortDirection == 'asc' ? '<' : '>'; $post = ArticleModel::isPublished()->where($sortField, $comparator, $currentPost->{$sortField})->orderBy($sortField, $sortDirection == 'asc' ? 'desc' : 'asc')->first(); if (!is_null($post)) { $post->setUrl($this->postPage, $this->controller); } // CW::info($post); return $post; }