santigarcor/laravel-ownable
A Laravel package that adds polymorphic ownership to Eloquent models, letting any model be assigned to users or other entities. It provides traits, relationships, and helpers to query owned records and manage ownership across your application.
$post->user_id === auth()->id() comparisons in controllers, policies, form requests and Blade.Adopt when:
null owner is a breach).owns(), ownedBy()) across all of them removes per-model boilerplate.Look elsewhere when:
spatie/laravel-permission or Laravel Gates/Policies. Ownership alone breaks the moment a teammate must edit a record they do not "own."user_id on one table. Laravel core's model comparison helpers plus a single policy method cover it with zero dependencies.For executives: "Ownership" — can this person edit, delete or share this record — is a permission question that shows up in most of our user-facing features. Today each team answers it slightly differently, which creates duplicate work and quiet security exposure at the edges. This is a small, free (MIT) building block that makes the answer consistent and testable in one place. Adoption cost is measured in hours, not sprints, it requires no database changes, and it does not lock us into a permissions architecture. Recommendation: use it where ownership checks already repeat; do not treat it as our authorization strategy. Where the business needs roles, teams, delegated access or audit trails, that should be scoped and funded separately — this package deliberately does not do it.
For engineering: it is a trait with a deliberately small method surface for polymorphic ownership checks — no migrations, no provider overhead, no runtime surprises. Two caveats to accept out loud: (1) it is a low-traffic package — 19 stars, one maintainer, last release December 2023 — so if it becomes load-bearing we should vendor or fork it and own the code rather than depend on upstream responsiveness; (2) it is not a substitute for Policies and Gates — call it inside policies so authorization stays centralized and reviewable. The open question for the team is not "does this save keystrokes" but "do we want one ownership convention?" If yes, adopting it (or copying it) buys us the convention; the dependency itself is optional.
How can I help you explore Laravel packages today?