Home / News / Package review: Laravel ownable

Package review: Laravel ownable

Here’s the sarcastic summary with ironic hashtags related to the topic at the start:
“`vbnet
Oh boy, you got me hooked on this Laravel package! 🤖 Laravel news has got me wondering about the package’s selling point – making any model owner or ownable! 🤖

But let’s break it down. One owner? No thanks, I’ve got enough people to keep my house in order. Plus, who has time to write code for multiple authors? That’s a real pain in the neck, isn’t it?

Adding manual code to events? Yeah, sure. But what if the owner suddenly decides to change their mind and sell the package? Or what if they need to support multiple owners? That’s a lot of potential headaches.

Polymorphic relationships? Oh, the irony. You’re talking about a package that could potentially add performance issues with a big, complex table (like a task_user_history). And let’s not forget, the chances of it happening are high, considering you might only have one relationship that creates many changes events or you use it for quite a few ownership relations.

I saw a post on this package on Laravel news.
The selling point of the package is making any model owner or ownable.

A few problems I see are;

  • There can be only one owner at one time. Something can be written by multiple authors, a house can by owned by multiple people, and that are the few cases from the top of my head.
  • It adds manual code to events that could be in an observer.
  • It uses polymorphic relationships which can become a performance problem when the relationship table becomes too large. I think the chance of this happening is very likely, because you only need one relationship that creates many change events or you use it for quite a few ownership relations.

I think the example is a bad one, that can be a one on one relationship and a task_user_history table.
The case that would have sold it better for me is; products that go from the warehouse, to the shipper and then to the buyer and back to the warehouse in case of a return.

All in all I think I will stick with specific relationships, observers and transactions to come to a solution.

Tagged:

Leave a Reply

Your email address will not be published. Required fields are marked *