public function scopeType($query, $input) { if (count($input) > 0) { $query->whereIn('category_id', $input); } }