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

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

mnurullahsaglam/laravel-owner
=============================

This is a simple package to add owner foreign id to models with a trait

1.1(3y ago)114[3 PRs](https://github.com/mnurullahsaglam/laravel-owner/pulls)MITPHPPHP ^8.0

Since Mar 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/mnurullahsaglam/laravel-owner)[ Packagist](https://packagist.org/packages/mnurullahsaglam/laravel-owner)[ Docs](https://github.com/mnurullahsaglam/laravel-owner)[ RSS](/packages/mnurullahsaglam-laravel-owner/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (4)Dependencies (10)Versions (9)Used By (0)

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

[](#laravel-owner)

[![Latest Version on Packagist](https://camo.githubusercontent.com/fa3b2d1700750ea40076f8d55684e0d67f57d10dc7e7b2f8bd9506e63a742f5c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6e7572756c6c61687361676c616d2f6c61726176656c2d6f776e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mnurullahsaglam/laravel-owner)[![GitHub Tests Action Status](https://camo.githubusercontent.com/6b6e2ec8f786e0847cbf6fe34afefd76ac393a4399f73db30a692de563d5946a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6e7572756c6c61687361676c616d2f6c61726176656c2d6f776e65722f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mnurullahsaglam/laravel-owner/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3bda18bebd83e315905b4b28e21e18fef65213e8847d63e0b565d8b60f68fd03/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6e7572756c6c61687361676c616d2f6c61726176656c2d6f776e65722f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/mnurullahsaglam/laravel-owner/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/08a6ddb4d82162deb855ef8d791ed407defb3fbbea2906f2af5baa42811489da/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6e7572756c6c61687361676c616d2f6c61726176656c2d6f776e65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mnurullahsaglam/laravel-owner)

This is a simple package to add owner foreign id to models with a trait.

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

[](#installation)

You can install the package via composer:

```
composer require mnurullahsaglam/laravel-owner
```

Usage
-----

[](#usage)

- Add `HasOwner` trait to your model.

By default, the owner model is `App\Models\User` and the owner key is `user_id`. If you want to change these values, you can override them in your model.

```
use Illuminate\Database\Eloquent\Model;
use Mnurullahsaglam\LaravelOwner\HasOwner;
use Mnurullahsaglam\LaravelOwner\OwnerSettings;

class Post extends Model
{
    use HasOwner;

    public function getOwnerSettings(): OwnerSettings
    {
        return OwnerSettings::create()
            ->setOwnerModel(App\Models\Owner::class)
            ->setOwnerKey('owner_id');
    }
}
```

You can access the owner model with `owner` relationship.

```
$post = Post::find(1);

return $post->owner;
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Mehmet Nurullah Sağlam](https://github.com/mnurullahsaglam)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.9% 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 ~3 days

Total

5

Last Release

1202d ago

Major Versions

0.3 → 1.12023-03-20

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f3b3a6b1db90ce037749334a7c5e9885634b1b13a0e3e2934fb2dc246a86d7b?d=identicon)[mnurullahsaglam](/maintainers/mnurullahsaglam)

---

Top Contributors

[![mnurullahsaglam](https://avatars.githubusercontent.com/u/32842660?v=4)](https://github.com/mnurullahsaglam "mnurullahsaglam (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (4 commits)")

---

Tags

laravelmnurullahsaglamlaravel-owner

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[rtconner/laravel-likeable

Trait for Laravel Eloquent models to allow easy implementation of a 'like' or 'favorite' or 'remember' feature.

400396.7k5](/packages/rtconner-laravel-likeable)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121137.5k](/packages/highsolutions-eloquent-sequence)[cybercog/laravel-nova-ban

A Laravel Nova banning functionality for your application.

42205.7k](/packages/cybercog-laravel-nova-ban)[cubettech/lacassa

Cassandra based query builder for laravel.

358.6k](/packages/cubettech-lacassa)[phaza/single-table-inheritance

Single Table Inheritance Trait

1515.8k](/packages/phaza-single-table-inheritance)

PHPackages © 2026

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