PHPackages                             packagedby/model-repositories - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. packagedby/model-repositories

Abandoned → [nathandunn/model-repositories](/?search=nathandunn%2Fmodel-repositories)Library[Database &amp; ORM](/categories/database)

packagedby/model-repositories
=============================

Easily create a repository using a Laravel Model

2.0.1(4y ago)08.2kPHPPHP ^8.0

Since Apr 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/packagedby/model-repositories)[ Packagist](https://packagist.org/packages/packagedby/model-repositories)[ RSS](/packages/packagedby-model-repositories/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (2)Versions (5)Used By (0)

Laravel Model Respositories
===========================

[](#laravel-model-respositories)

Wraps around [Eloquent models](https://laravel.com/docs/8.x/eloquent) allowing them to be used as repositories.

Why?
----

[](#why)

Because getting a collection from a model "object" isn't really a models role, and is deceptive when injecting a model and using it in another context

Inspired by [Jack Wagstaffe](https://github.com/jackowagstaffe)

Install
-------

[](#install)

You can install the package with [Composer](https://getcomposer.org/) by running the following command:

```
composer require packagedby/model-repositories

```

Usage instructions
------------------

[](#usage-instructions)

Below is an example of an example repository for a `Record` model. This extends the base `Repository` class and adds a custom `forUser` method.

```
