haizone
10 months ago

how return collaction from get____Attribute

Posted 10 months ago by haizone

hi how i can return a collaction from a model with get____Attribute

i do somthing like that but its didnt work and still retun me an array:

     public function getBusinessCategoryAttribute(){
             return collect($this->business()->first()->categories()->first());
     }   

Please sign in or create an account to participate in this conversation.