Looking to hire Laravel developers? Try LaraJobs

laravel-eloquent-model-interface maintained by buyersclub

Description
Polyfill for the "missing" Laravel Eloquent model interface.
Last update
2021/08/08 15:05 (dev-master)
License
Links
Downloads
65

Comments
comments powered by Disqus

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
{
    //
}