PHP code example of jaspaul / eloquent-sti
1. Go to this page and download the library: Download jaspaul/eloquent-sti 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/ */
jaspaul / eloquent-sti example snippets
use Tests\Helpers\User;
use Tests\Helpers\Administrator;
use Jaspaul\EloquentSTI\Inheritable;
use Illuminate\Database\Eloquent\Model;
class User extends Model
{
use Inheritable;
/**
* Provides a map of types to resolve for this object. The format is:
* 'user' => User::class,
* 'administrator' => Administrator::class
*
* @var array
*/
protected $types = [
'user' => User::class,
'administrator' => Administrator::class
];
}
class Administrator extends User
{
}