PHP code example of proai / eloquent-inheritance

1. Go to this page and download the library: Download proai/eloquent-inheritance library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

proai / eloquent-inheritance example snippets


use ProAI\Inheritance\Inheritance;

class Pet extends Model
{
    use Inheritance;

    //
}

class Cat extends Pet
{
    //
}

class Dog extends Pet
{
    //
}

class Pet extends Model
{
    use Inheritance;

    protected static $inheritanceMap = [
        'cat' => Cat::class,
        'dog' => Dog::class,
    ];
}

use ProAI\Inheritance\Inheritance;

class Pet extends Model
{
    use Inheritance;

    protected static $inheritanceColumn = 'pet_type';
}