I'd suggest writing your own html helper function for such situations. I wouldn't put in a model or php class, unless required.
If you see the need for this across multipe models, maybe think of using a Trait (re-usable methods for classes).
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community