webbingbrasil/eloquent-sti

Brings a Single Table Inheritance capabilities to Eloquent.
1,028 1
Install
composer require webbingbrasil/eloquent-sti
Latest Version:1.0.0
PHP:>=5.6.4|^7.0
License:MIT
Last Updated:Feb 7, 2024
Links: GitHub  ·  Packagist
Maintainer: dmandrade

Eloquent STI

Eloquent STI brings a Single Table Inheritance capabilities to Eloquent.

Installation

composer require "webbingbrasil/eloquent-sti=1.0.0"

Usage

Use the CanBeInherited trait in any entity to get STI capabilities in childs

use WebbingBrasil\EloquentSTI\CanBeInherited;

class User extends Model
{
    use CanBeInherited;
}

Now just extend the parent model with any child models

class Admin extends User
{
}

class Manager extends User
{
}

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

631,580,251 9,707
laravel/framework

The Laravel Framework.

580,311,802 34,925
laravel/tinker

Powerful REPL for the Laravel framework.

489,754,436 7,444
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

404,034,618 608
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

384,821,166 4,658