alariva/modelmerge

A Laravel package for Merging Eloquent Models

v0.4 2018-09-16 18:01 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version Build Status Maintainability Test Coverage License FOSSA Status

Easy merging for Eloquent Models.

Installation

Via Composer

$ composer require alariva/modelmerge

Usage

    $modelA = SampleModel::make(['firstname' => 'John', 'age' => 33]);
    $modelB = SampleModel::make(['firstname' => 'John', 'lastname' => 'Doe']);

    $mergedModel = ModelMerge::setModelA($modelA)->setModelB($modelB)->merge();

    $mergedModel->firstname; // John
    $mergedModel->lastname; // Doe
    $mergedModel->age; // 33

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

FOSSA Status