Package Data | |
---|---|
Maintainer Username: | patinthehat |
Maintainer Contact: | trick.developer@gmail.com (Patrick Organ) |
Package Create Date: | 2017-04-01 |
Package Last Update: | 2017-04-01 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-14 15:12:23 |
Package Statistics | |
---|---|
Total Downloads: | 10 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 4 |
Total Forks: | 1 |
Total Open Issues: | 0 |
This package provides a basic Repository pattern implementation for use with Laravel 5+.
This package may be installed with composer:
composer require patinthehat/laravel-repositories
Extend the Repository
class and define its model
method to create a repository for that model:
use Permafrost\Repository;
class UserRepository extends Repository
{
public static function model()
{
return 'App\\User';
}
}
The repository can then be used:
$user = UserRepository::findByFirstName('john');
The Repository
class allows for dynamic findByN/findAllByN
method calls, which will search the repository model's field N for its first argument.
For example,
UserRepository::findByFirstName('john')
results in a call to
User::where('first_name', 'john')->first()
This package is open source software, available under the MIT license. See LICENSE for more information.