Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Eloquent Owner Access Laravel Package

whilesmart/eloquent-owner-access

A lightweight Laravel package that adds owner and access-control behavior to Eloquent models, letting you assign owners and authorize who can view, edit, or share records with simple, reusable traits.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature scoping without tenancy lock-in. Any feature where records belong to "someone" — comments, invoices, documents, attachments, notifications, audit entries — can ship as owner-scoped from day one. The package stores owner_type/owner_id and delegates the "who may read/write this" decision to the host app, so the feature does not have to hardcode user vs team vs organization vs tenant.
  • Build vs buy for internal authorization glue. Most teams that need this write the same ~100 lines: a trait, a polymorphic relation, a global scope, and a policy stubs. This package replaces that with a small MIT dependency and a documented contract — a reasonable "buy" where the alternative is bespoke code that every package in your monorepo reimplements.
  • Roadmap optionality. Products frequently start single-owner (personal accounts) and later need shared/team/workspace ownership. Adopting a polymorphic owner column now means that migration is a data/authorization-policy change, not a schema rewrite across every owner-scoped table.
  • Package ecosystem strategy. If you maintain multiple Laravel packages (the repo's stated audience), this lets each package accept any host tenancy model instead of forcing one. That directly increases addressable users of your packages and reduces support burden from "how do I make this work with my multi-tenant setup?".
  • Concrete use cases: SaaS with User + Organization owners; marketplaces with buyer/seller-owned records; LMS with school/department/teacher ownership; white-label CMS with brand-owned content; internal tools where ownership is a cost center or project.
  • Adoption risk is itself a decision input. 0 stars, 0 dependents, first surfaced release — treat this as an evaluation signal, not a production signal. Budget for a spike, not a dependency review.

When to Consider This Package

Adopt (or at least prototype) when all of these hold:

  • You are building or maintaining a Laravel package (or a modular monolith with shared domain packages) that persists owner-scoped records.
  • The ownership entity genuinely varies by host app, or is expected to vary within 12–18 months.
  • You want authorization decisions to live in the host app's Gate/policy layer rather than in your package.
  • Your team can absorb a young dependency: MIT license means you can fork and vendor it, and the surface area is small enough to audit in an afternoon.
  • You can pin a version and add a thin internal wrapper so a future replacement is a one-file change.

Look elsewhere when:

  • There is exactly one ownership model and no credible roadmap for another — a plain user_id foreign key plus a Laravel policy is simpler and has zero dependency risk.
  • You need database-level enforcement (row-level security, Postgres RLS) rather than application-level scopes; a global scope is bypassable and this package does not change that.
  • You need rich role/permission hierarchies, delegation, or sharing graphs — that is spatie/laravel-permission or a dedicated ACL, not owner scoping.
  • You need true multi-tenancy with per-tenant databases, migrations, or cache/queue isolation — that is stancl/tenancy territory; owner columns solve authorization, not isolation.
  • Compliance or procurement requires a maintained dependency with a security disclosure process and usage base. Zero dependents and zero stars is a real signal here.
  • You need auditing of access decisions out of the box.

How to Pitch It (Stakeholders)

To executives: This is a small MIT-licensed library that lets our packages and features store records against any kind of owner — a user, a team, an organization — and lets each customer's app decide who can see and change those records. The business value is optionality: we can ship owner-scoped features now and add team/workspace ownership later without rewriting our data model or our packages. Cost is near zero (MIT, ~one trait and a contract), and the risk is contained because the code is small and forkable. Recommendation: fund a 1–2 day spike, not a platform-wide commitment. Adoption signals are essentially zero today, so we should pin it, wrap it behind our own interface, and revisit in one quarter.

To engineering: One trait adds polymorphic owner_type/owner_id columns and an owner relation; authorization is not implemented here — it is delegated to a contract the host application binds, so your Gate/policies remain the single source of truth. That keeps our packages tenancy-agnostic and eliminates the "which tenancy package do you support?" support matrix. The trade-offs are the usual ones for polymorphic ownership: no real foreign-key integrity on owner_id, global scopes can be bypassed with withoutGlobalScope, and there is no compiled/indexed tenancy boundary. Mitigate with a composite index on (owner_type, owner_id), an internal adapter class, a version pin, and a fork-and-patch contingency given the license. If we go ahead, the acceptance test is: swap the owner from User to Team in a staging app without touching package code.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package