StorageFile::class, 'files' => 'array', 'medias' => 'array', 'extension' => 'array', 'published_at' => 'datetime', ]; public static function getCategoryList() { return Keyword::where('key', 'like', 'category_%')->get(); } public function category() { return $this->belongsTo(Keyword::class, 'category_id'); } public function scopeSort($q) { return $q->orderBy('sort', 'asc')->latest('published_at')->latest('id'); } public function scopePublish($q) { return $q->where('published_at', '<=', now())->where('is_enable', 1); } }