buyersclub/laravel-eloquent-model-interface

This package is abandoned and no longer maintained. No replacement package was suggested.

Polyfill for the "missing" Laravel Eloquent model interface.

2.1.1 2021-08-08 13:05 UTC

This package is auto-updated.

Last update: 2024-04-08 18:59:09 UTC


README

Latest Stable Version License

Model Interface

Polyfill for the "missing" Laravel Eloquent model interface.

Installation

composer require buyersclub/laravel-eloquent-model-interface

Why

If you are using interfaces for your models, you might have methods that return an arbitrary model, in those cases it convenient to be able to use a typehint that reflects that. Without this polyfill this can only be done by typehinting \Illuminate\Database\Eloquent\Model which will not be fully compatible with your model interfaces, by introducing this base interface that your model interfaces can extand this problem can be solved.

This is especially useful when you are using static analyzers such as PHPStan or similar.

Usage

use Buyersclub\Laravel\Eloquent\EloquentModelInterface;

interface UserInterface extends EloquentModelInterface
{
    //
}