PHPackages                             norse-blue/parentity - 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. norse-blue/parentity

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

norse-blue/parentity
====================

Parentity is a package that allows the use of MTI entities in Laravel 5.7+ using Eloquent models.

v0.1(7y ago)478[1 issues](https://github.com/norse-blue/php-parentity/issues)[1 PRs](https://github.com/norse-blue/php-parentity/pulls)MITPHP

Since Sep 23Pushed 5y ago2 watchersCompare

[ Source](https://github.com/norse-blue/php-parentity)[ Packagist](https://packagist.org/packages/norse-blue/parentity)[ RSS](/packages/norse-blue-parentity/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

Parentity
=========

[](#parentity)

Parentity is a package that allows the use of MTI (Multi-Table Inheritance) entities in Laravel 5.7+ using Eloquent models.

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

[](#installation)

```
composer require "norse-blue/parentity"
```

Usage
-----

[](#usage)

1. Create parent model table with the following fields:

    ```
    $table->string('entity_type')->nullable();
    $table->unsignedInteger('entity_id')->nullable();
    ```

    *Note: Use the proper id type for your child models (unsignedInteger, unsignedBigInteger, ...).*
2. Create parent model that extends `Models` and uses `IsMtiParentModel`trait:

    ```
