Entity

Entity presents a table in your database.

Example


namespace Vendor\Domain\Entity;

use Pckg\Database\Entity;
use Vendor\Domain\Record\User;

class Users extends Entity
{
    protected $record = User::class;
}

Usage

Relations

All relations should be defined as an Entity method. See > Relations for more examples.

Scopes

You can extract and reuse common scopes to methods.

You can then call scopes in your controllers, services or everywhere else.

Extensions

You can extend the Entity

Factory

Instead of creating the entity with new, you can also create an entity from the factory.

Last updated