PHPackages                             pandorga/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. pandorga/owner

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

pandorga/owner
==============

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

1.2(5y ago)0131MITPHPPHP ^7.2.5

Since Apr 27Pushed 5y ago2 watchersCompare

[ Source](https://github.com/pandorgaco/owner)[ Packagist](https://packagist.org/packages/pandorga/owner)[ Docs](https://github.com/pandorga/owner)[ RSS](/packages/pandorga-owner/feed)WikiDiscussions master Synced 6d ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

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 organizations.

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

[](#installation)

### Requirements

[](#requirements)

- Composer
- Laravel Framework 5.7+/6.0+/7.0+

### Installing

[](#installing)

Run the following command in your console terminal:

```
$ composer require pandorga/owner
```

Publish the migrations and config files:

```
$ php artisan vendor:publish --provider="Pandorga\Owner\OwnerServiceProvider"
```

Run the migrations:

```
$ php artisan migrate
```

Usage
-----

[](#usage)

### Add necessary traits your Eloquent models:

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

If the model can be an owner:

```
use Pandorga\Owner\Traits\Owns;

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

If the model can be owned by another model:

```
use Pandorga\Owner\Traits\HasOwner;

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

Usage
-----

[](#usage-1)

### "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);
```

Remove all owners from the model

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

Security
--------

[](#security)

If you discover any security related issues, please use the issue tracker.

Credits
-------

[](#credits)

- [Felix Ayala](http://felixaya.la)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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.

###  Release Activity

Cadence

Every ~117 days

Total

3

Last Release

1978d ago

PHP version history (2 changes)v1.0PHP &gt;=7.2

1.2PHP ^7.2.5

### Community

Maintainers

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

---

Top Contributors

[![zrkb](https://avatars.githubusercontent.com/u/947557?v=4)](https://github.com/zrkb "zrkb (6 commits)")

---

Tags

laravelownerphpphplaravelowner

### Embed Badge

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

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

###  Alternatives

[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

591444.8k2](/packages/spiritix-lada-cache)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2031.2M2](/packages/glushkovds-phpclickhouse-laravel)[cybercog/laravel-ownership

Laravel Ownership simplify management of Eloquent model's owner.

9126.6k3](/packages/cybercog-laravel-ownership)[io238/laravel-iso-countries

Ready-to-use Laravel models and relations for country (ISO 3166), language (ISO 639-1), and currency (ISO 4217) information with multi-language support.

5462.3k](/packages/io238-laravel-iso-countries)[sebastiaanluca/laravel-boolean-dates

Automatically convert Eloquent model boolean attributes to dates (and back).

40111.7k1](/packages/sebastiaanluca-laravel-boolean-dates)[inani/larapoll

A Laravel package to create polls

25517.7k1](/packages/inani-larapoll)

PHPackages © 2026

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