Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tonysm/eloquent-sti

A lite-weight implementation of SingleTableInheritance (STI) on Eloquent.
https://github.com/tonysm/eloquent-sti

Last synced: about 1 month ago
JSON representation

A lite-weight implementation of SingleTableInheritance (STI) on Eloquent.

Awesome Lists containing this project

README

        

A lite-weight implementation of SingleTableInheritance (STI) on Eloquent.

## Introduction

Let's say you have a User model like so:

```php
create();
factory(User::class)->create(['type' => Employee::class]);
$users = User::all();
```

This would result in a collection containing one instance of `User` and one instance of `Employee`.

Check the [tests](tests/) folder for more usage examples.