Skip to content

Lift for LaravelTake your Eloquent Models to the next level

Describe casts, fillable fields, validation, relationships, and events with PHP attributes on typed public properties, right where your editor can see them.

Lift for Laravel

Same model, higher up

Ground levelplain Eloquent
final class Product extends Model
{
    protected $fillable = ['name', 'price'];

    protected $casts = [
        'price' => 'float',
    ];

    public function category(): BelongsTo
    {
        return $this->belongsTo(Category::class);
    }
}
With Lifttyped and validated
#[BelongsTo(Category::class)]
final class Product extends Model
{
    use Lift;

    #[Fillable]
    #[Rules(['required', 'string'])]
    public string $name;

    #[Fillable]
    #[Cast('float')]
    public float $price;
}