Need a clean, reusable solution to handle ownership dynamics in your Laravel app? Enter Laravel Ownable — a polished package by Abdullah Sowailem that lets any Eloquent model own any other model. Whether you’re managing users and tasks, vendors and products, or documents with dynamic custodians, this package brings clarity, flexibility, and auditability to ownership logic.

Here’s a refreshed overview for your blog, incorporating up-to-date insights from the official repository (updated August 10, 2025).


The Essentials

Laravel Ownable offers:

  • Flexible, polymorphic ownership — any model can own or be owned by any other model.
  • Ownership transfer and tracking — move ownership gracefully and keep a historical log.
  • Quick access to the current owner — fetch who currently owns a resource.
  • Clean-up support — when a model is deleted, its associated ownership records are automatically removed.
  • Facade support — a user-friendly Owner facade for streamlined ownership operations.

Requirements & Installation

Supported versions:

  • PHP 8.0+
  • Laravel 9.x, 10.x, 11.x, or 12.x

Installation Steps:

composer require sowailem/ownable
php artisan vendor:publish --provider="Sowailem\Ownable\OwnableServiceProvider" --tag="ownable-migrations"
php artisan migrate

Model Setup & Key Operations

Define Owner and Ownable Models:

Owner Model (e.g., User):

use Sowailem\Ownable\Traits\HasOwnables;
use Sowailem\Ownable\Contracts\Owner as OwnerContract;

class User extends Authenticatable implements OwnerContract
{
    use HasOwnables;
}

Ownable Model (e.g., Post):

use Sowailem\Ownable\Traits\IsOwnable;
use Sowailem\Ownable\Contracts\Ownable as OwnableContract;

class Post extends Model implements OwnableContract
{
    use IsOwnable;
}

Using the API:

  • Give ownership:
$user->giveOwnershipTo($post);
$post->ownedBy($user);
Owner::give($user, $post);
  • Check ownership:
$user->owns($post);
$post->isOwnedBy($user);
Owner::check($user, $post);
  • Transfer ownership:
$user->transferOwnership($post, $newOwner);
$post->transferOwnershipTo($newOwner);
Owner::transfer($user, $newOwner, $post);
  • Insights and cleanup:
$user->ownables()->get(); // All items owned
$post->currentOwner();    // Current owner
$post->owners()->get();   // All past + current owners
$user->takeOwnershipFrom($post); // Remove ownership

Configuration & Database Schema

You can publish and customize config options like the default owner model, ownable model, or database table via:

php artisan vendor:publish --provider="Sowailem\Ownable\OwnableServiceProvider" --tag="ownable-config"

DB Schema — ownerships table includes:

  • Primary key (id)
  • owner_id, owner_type
  • ownable_id, ownable_type
  • is_current (boolean to indicate the active ownership)
  • Timestamps (created_at, updated_at)

Why It Matters

Laravel Ownable brings a lot to the table:

  • Zero boilerplate — No reinventing ownership logic between models.
  • Consistent API — Use traits or the static facade interchangeably.
  • Historical context — Query past owners or examine how ownership changed.
  • Safe and neat — Auto-clean and strong relational behavior built in.

Laravel Ownable takes the pain out of handling ownership logic. Instead of reinventing the wheel for every model pair, you get a ready-made system that is flexible, consistent, and easy to integrate.

Source code on GitHub