public function search()
{
$criteria = new CDbCriteria();
$criteria->compare('t.id', $this->id, true);
$criteria->compare('blog_id', $this->blog_id);
$criteria->compare('t.create_user_id', $this->create_user_id, true);
$criteria->compare('t.update_user_id', $this->update_user_id, true);
$criteria->compare('t.create_time', $this->create_time);
$criteria->compare('t.update_time', $this->update_time);
$criteria->compare('t.slug', $this->slug, true);
if ($this->publish_time) {
$criteria->compare('DATE(from_unixtime(publish_time))', date('Y-m-d', strtotime($this->publish_time)));
}
$criteria->compare('title', $this->title, true);
$criteria->compare('quote', $this->quote, true);
$criteria->compare('content', $this->content, true);
$criteria->compare('link', $this->link, true);
$criteria->compare('t.status', $this->status);
$criteria->compare('comment_status', $this->comment_status);
$criteria->compare('access_type', $this->access_type);
$criteria->compare('t.category_id', $this->category_id, true);
$criteria->with = ['createUser', 'updateUser', 'blog'];
return new CActiveDataProvider('Post', ['criteria' => $criteria, 'sort' => ['defaultOrder' => 't.publish_time DESC, t.id DESC']]);
}