2017 © Pedro Peláez
 

library repottern

Repottern is a repository pattern for Laravel.

image

anik/repottern

Repottern is a repository pattern for Laravel.

  • Saturday, July 23, 2016
  • by ssi-anik
  • Repository
  • 0 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Repottern - A repository pattern for Laravel >= 5

Those who are working with MVC and want to work in Thin Model, Thin Controller, Fat Repository. This one will do this for you. This works like the Laravel Eloquent does. Exactly the same, with some extra features., (*1)

Requirements:

  • Laravel 5+
  • PHP 5.6+

How to install

composer require anik/repottern, (*2)

Usages

To make it use, you've to create a Class, where your Class which will extend Anik\Repottern\BaseRepository , next implement the model method from that class and you're done., (*3)

Now, you can inject this class to method, to constructor, or can call the methods statically using that class., (*4)

Assuming you've an User model. Now,, (*5)

<?php
// Repository
class UserRepository extends BaseRepository
{
    public function model ()
    {
        return User::class;
    }   

    protected function findUserWithWildCard()
    {
        return $this->where('username', 'LIKE', "%n%")->get();
    }
}
<?php
// From controller
class HomeController extends Controller
{
    public function controllerMethod(UserRepository $repository)
    {
        # return $repository->with('role')->get();
        # return $repository->paginate(10);
        # return $repository->find(10);
        # return $repository->findUserWithWildCard();

        # return UserRepository::with('role')->get();
        # return UserRepository::paginate(10);
        # return UserRepository::find(10);
        # return UserRepository::findUserWithWildCard();

    }
}

Things to note in here, to call the methods statically with the class name, you MUST have to use the protected access modifier with that method name, (*6)

License

Repottern is released under the MIT Licence., (*7)

Bugs and Issues

If you find any bug or other issues, please open an issue and let me know. Forks are always welcomed., (*8)

The Versions

23/07 2016

dev-master

9999999-dev

Repottern is a repository pattern for Laravel.

  Sources   Download

MIT

The Requires

 

by Avatar ssi-anik

23/07 2016

1.0.1

1.0.1.0

Repottern is a repository pattern for Laravel.

  Sources   Download

MIT

The Requires

 

by Avatar ssi-anik

07/07 2016

1.0.0

1.0.0.0

Repottern is a repository pattern for Laravel.

  Sources   Download

MIT

The Requires

 

by Avatar ssi-anik