Vector::class, '_lft' => 'int', '_rgt' => 'int', 'parent_id' => 'int', 'subcategories' => 'object', 'meme_angles' => 'array', 'sample_captions' => 'array', 'keywords' => 'array', 'payload' => 'object', 'system_memes_generated_count' => 'int', ]; protected $fillable = [ 'name', 'slug', 'description', '_lft', '_rgt', 'parent_id', 'subcategories', 'meme_angles', 'sample_captions', 'keywords', 'payload', 'system_memes_generated_count', ]; /** * Scope to get only main categories */ public function scopeMainCategories($query) { return $query->whereNull('parent_id'); } /** * Scope to get only subcategories */ public function scopeSubcategories($query) { return $query->whereNotNull('parent_id'); } }