PHPackages                             inventive/laravel-owner - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. inventive/laravel-owner

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

inventive/laravel-owner
=======================

Allow Eloquent models to own each other. Supports many to many relationships.

091[1 issues](https://github.com/stephenahiggins/laravel-owner/issues)PHP

Since Feb 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/stephenahiggins/laravel-owner)[ Packagist](https://packagist.org/packages/inventive/laravel-owner)[ RSS](/packages/inventive-laravel-owner/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Laravel Owner](https://camo.githubusercontent.com/be6fcfd5fc903b3012132250e09a798ca567f8c4e0f2a485f6d6e6c2f4147f10/687474703a2f2f7777772e6c6574736265696e76656e746976652e636f2e756b2f696d672f6c61726176656c2d6f776e65722d736d2e706e67)](https://camo.githubusercontent.com/be6fcfd5fc903b3012132250e09a798ca567f8c4e0f2a485f6d6e6c2f4147f10/687474703a2f2f7777772e6c6574736265696e76656e746976652e636f2e756b2f696d672f6c61726176656c2d6f776e65722d736d2e706e67)

Laravel Owner
=============

[](#laravel-owner)

A simple package that allows Eloquent models to "own" each other, or "be owned" by another model. Supports many to many relationships.

Examples could include:

1. a user owning a blog post
2. a user *and* a team owning multiple files
3. record being owned by many organisations

Installation
------------

[](#installation)

Install using composer:

```
composer require inventive/laravel-owner=dev-master
```

Add the following to `config/app.php`:

```
Inventive\LaravelOwner\OwnerServiceProvider::class,
```

Publish the migrations and config files:

```
php artisan vendor:publish
```

Run the migrations:

```
php artisan migrate
```

### Add necessary traits your Eloquent models:

[](#add-necessary-traits-your-eloquent-models)

If the model can be an owner:

```
use Inventive\LaravelOwner\Traits\Owns;

class User extends Model
{
	use Owns;
}
```

If the model can be owned by another model:

```
use Inventive\LaravelOwner\Traits\HasOwner;

class Resource extends Model
{
	use HasOwner;
}
```

Usage
-----

[](#usage)

### "Owner" model:

[](#owner-model)

Create an ownership:

```
$user->own($model);
```

Remove an ownership:

```
$user->disown($model);
```

Return a collection of *all* the models owned by the parent model:

```
$user->owns();
```

Does the user own this model?

```
$user->ownsModel($model);
```

Which models of this type does the parent model own? This method either takes a child model, or a name-spaced class name.

```
$user->ownsModelType($model); // Use a model
$user->ownsModelType(‘App\Resource’); // Use class name
```

### "Owned" model:

[](#owned-model)

Return a collection of all the model's owners:

```
$model->owners();
```

Is the model is owned by another model?

```
$model->isOwnedBy($owner);
```

Add an owner to the model:

```
$model->addOwner($owner);
```

Remove an owner from the model

```
$model->removeOwner($owner);
```

License
-------

[](#license)

MIT

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a05bfc569a1cb396a99b58eb37396169752b849728b498c3690ecc6000a5fe36?d=identicon)[stephenahiggins](/maintainers/stephenahiggins)

---

Top Contributors

[![stephenahiggins](https://avatars.githubusercontent.com/u/12612312?v=4)](https://github.com/stephenahiggins "stephenahiggins (15 commits)")

### Embed Badge

![Health badge](/badges/inventive-laravel-owner/health.svg)

```
[![Health](https://phpackages.com/badges/inventive-laravel-owner/health.svg)](https://phpackages.com/packages/inventive-laravel-owner)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198628.3k10](/packages/pgvector-pgvector)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
