PHP code example of oldtimeguitarguy / eloquent-single-table-inheritance

1. Go to this page and download the library: Download oldtimeguitarguy/eloquent-single-table-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/ */

    

oldtimeguitarguy / eloquent-single-table-inheritance example snippets


class Person extends StiParent
{
    protected $table = 'people';
    protected static $stiKey = 'sex';
    protected static $stiChildren = [
        'boy' => Boy::class,
        'girl' => Girl::class,
    ];
}

class Boy extends Person
{
    //
}

class Girl extends Person
{
    //
}