Get accessor attribute within collection

Hi. I have a collection from a model and there is an extra attribute to generate the url for this element. In laravel blade everything works when i call:


But i use vuejs and send all companies at once into vue component. I can access there everything from my normal $company. Like the title, description, ... but not the new attribute i defined in model with public function getAppLinkAttribute(). Hope somebody can help. thx.

  • 2 months ago

You need to read the section on Eloquent Serialization. It explains how to add accessors to the output. Good luck :)