brands = $brandRepository->getList([]); if ($this->brands->count() < 9) { // Ensure we have at least 9 brands by duplicating if necessary while ($this->brands->count() < 9) { $this->brands = $this->brands->concat($this->brands); } $this->brands = $this->brands->take(9); } } /** * Get the view / contents that represent the component. */ public function render(): View|Closure|string { $view = 'components.home.brand-home-fashion-v1'; if ($this->template === 'fashion-v2') { $view = 'components.home.brand-home-fashion-v2'; } return view($view); } }