railken/eloquent-instance
Eloquent Instance
A simple trait that enables the use of instance of Model in your relationships. Why? Because otherwise it would be impossible to relate two models that doesn't exist in the code, but only as instances (e.g. stored in db)
Requirements
PHP 7.2 and laravel 5.8
Installation
You can install it via Composer by typing the following command:
composer require railken/eloquent-instance
Usage
Simple include Railken\EloquentInstance\HasRelationships in your model and start using
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Railken\EloquentInstance\HasRelationships;
class Author extends Model
{
use HasRelationships;
public function books()
{
$book = new Book();
$book->setTable('book_custom');
return $this->hasMany($book);
}
}
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
651,963,193
9,701
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
435,097,283
607
nunomaduro/collision
Cli error handling for console/command-line PHP applications.
407,699,310
4,663
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v2.0.0 | >=8.1 | 9.* || | MIT | |
| v1.0.2 | >=7.1 | MIT | ||
| v1.0.1 | >=7.1 | MIT | ||
| v1.0.0 | >=7.1 | MIT |