PHPackages                             iuliangusetoaia/laravel-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. iuliangusetoaia/laravel-repositories

ActiveLibrary[Database &amp; ORM](/categories/database)

iuliangusetoaia/laravel-repositories
====================================

Laravel repositories using the native Eloquent functions!

1.1.1(6y ago)06MITPHP

Since Mar 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/IulianGusetoaia/laravel-repositories)[ Packagist](https://packagist.org/packages/iuliangusetoaia/laravel-repositories)[ RSS](/packages/iuliangusetoaia-laravel-repositories/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)DependenciesVersions (10)Used By (0)

Laravel Eloquent Repositories
=============================

[](#laravel-eloquent-repositories)

1. [Installation](#1-installation)
2. [Make a repository class](#2-make-a-repository-class)
3. [Making facade](#3-making-facade)

1. Installation
---------------

[](#1-installation)

Just install it through Composer:

```
composer require iuliangusetoaia/laravel-repositories

```

After installation you can start using the repository pattern with Laravel.

2. Make a repository class
--------------------------

[](#2-make-a-repository-class)

This package provide a new Artisan command to create a repository class. All the classes will be generated on the `App\Repositories` folder, if this folder is missing, it will be generated automatically.

```
php artisan make:repository ProductRepository

```

You can use the `--model` option to define the Eloquent model that will be linked to this repository.

```
php artisan make:repository ProductRepository --model=App\Product

```

Don't forget to write the **full namespace** of your model, using '\\' as the separator.

### Example:

[](#example)

In this example I assume that you already have a model named Product. Used the command

```
php artisan make:repository ProductRepository --model=App\Models\Product

```

```
