Tony Messias

February 22, 2022

Globalid Laravel

Polymorphism is a very known concept in programming. To put it simply: it's the idea that many things can play the same role in a system. For instance, think about the Pull Request Reviewer feature on GitHub. You can assign a single team member, multiple, or an entire team as the reviewer.

I've blogged about how to make use of the Globalid Laravel package to implement polymorphism in your Laravel apps. Globalids are very useful in all sorts of situations where you want to use polymorphism. I'm using that in the Rich Text Laravel package, for instance, to store references to models when you use them as attachments. Instead of serializing the model, we can store the URI to that model and use the Locator to find it for us when it's time to render the document again.

Here's the link to the post: https://www.tonysm.com/globalid-laravel/

I'm blogging on my personal site mainly because the syntax highlight here in Hey World sucks (because there isn't any). I think I'll use Hey World more like a newsletter instead of a blog. When I have something code heavy, I'll post it on my blog and send a link to the list.

Let me know what you think!