2017 © Pedro Peláez
 

library laravel-repository

Stateful repositories for Laravel models.

image

ymslavov/laravel-repository

Stateful repositories for Laravel models.

  • Monday, May 1, 2017
  • by ymslavov
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1,246 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

Stateful Repository Implementation

Based on the work featured in bosnadev.com, but with a few additional helpful methods for multi-record operations., (*1)

Laravel 5.3+ required., (*2)

Installation via Composer

composer require ymslavov/laravel-repository

Using Repository Generators

The package provides an easy way to generate repository classes for all models in the system., (*3)

All you need to do is register the service provider in your config/app.php in the 'providers' array:, (*4)

'providers' => [
    ...other providers here...,
    YasenSlavov\LaravelRepository\Providers\LaravelRepositoryServiceProvider::class
]

And then use the following command in your command line tool:, (*5)

php artisan repositories:generate

The script will scan the app/ directory for any classes that extend the Eloquent Model class and create repository classes for them., (*6)

Extending the AbstractRepository directly

If you prefer not to use the auto-generated classes, you can simply extend the AbstractRepository class directly from the package., (*7)

Example:, (*8)

class UsersRepository extends AbstractRepository {
  /**
     * Specify the fully-qualified model name. Best use Classname::class
     *
     * @return string
     */
    function model()
    {
        return User::class;
    }
}


$usersRepo = \App::make(UsersRepository::class);

$usersWithTitleManager = $usersRepo
                            ->clearScope() //clear any state already established in the repo object
                            ->pushCriteria(new ByRoleTitle('Manager'))
                            ->all();

The Versions

01/05 2017

dev-master

9999999-dev

Stateful repositories for Laravel models.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

01/05 2017

3.0

3.0.0.0

Stateful repositories for Laravel models.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

19/01 2017

2.1.1

2.1.1.0

Stateful repositories for Laravel models.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

19/01 2017

2.1

2.1.0.0

Stateful repositories for Laravel models.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

19/01 2017

2.0.1

2.0.1.0

Stateful repositories for Laravel models.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

15/01 2017

2.0

2.0.0.0

Stateless repositories for Laravel models.

  Sources   Download

The Requires

 

by Yasen Slavov

13/01 2017

1.2

1.2.0.0

Stateless repositories for Laravel models.

  Sources   Download

The Requires

 

by Yasen Slavov

12/01 2017

1.1

1.1.0.0

Stateless repositories for Laravel models.

  Sources   Download

The Requires

 

by Yasen Slavov

12/01 2017

1.0

1.0.0.0

Models for the WorkRest-related webservices.

  Sources   Download

The Requires

 

by Yasen Slavov