Download the PHP package ra3oul/eloquent-abstract-repository without Composer
On this page you can find all versions of the php package ra3oul/eloquent-abstract-repository. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ra3oul/eloquent-abstract-repository
More information about ra3oul/eloquent-abstract-repository
Files in ra3oul/eloquent-abstract-repository
Package eloquent-abstract-repository
Short Description laravel eloquent abstract repository to implement repository pattern in easy way
License MIT
Informations about the package eloquent-abstract-repository
Laravel 5 Eloquent Abstract repository
using repository pattern in laravel with a great base repository
Table of Contents
- Installation
- Composer
- Service Provider
-
Methods
- RepositoryInterface
- Usage
- Create a Model
- Create a Repository
- Create service Provider
- Use methods
Installation
Composer
Execute the following command to get the latest version of the package:
Laravel
In your config/app.php
add
ra3oul\EloquentAbstractRepository\EloquentAbstractRepositoryServiceProvider::class
to the end of the providers
array:
Methods
ra3oul\EloquentAbstractRepository\repository\RepositoryInterface
- create($columns = array('*'))
- findOneById($id )
- findOneBy($key , $value )
- findManyBy($key,$value])
- findManyByIds($ids = array())
- findAll()
- findManyByCredentials($credentials = array())
- paginateBy($key, $value, $perPage = 10)
- paginate($perPage = 10)
- paginateByCredentials(array $credentials, $perPage = 10)
- updateOneById($id, array $data = [])
- updateOneBy($key, $value, array $data = [])
- updateOneByCredentials(array $credentials, array $data = []');
- updateManyBy($key, $value, array $data = []);
- updateManyByCredentials(array $credentials = [], array $data = []);
- updateManyByIds(array $ids, array $data = []);
- function deleteOneById($id);
- public function allExist(array $ids);
- deleteOneBy($key, $value);
- deleteOneByCredentials(array $credentials = []);
- deleteManyBy($key, $value);
- deleteManyByCredentials(array $credentials = []);
- deleteManyByIds(array $ids);
- searchByCredentials(array $credentials = [], $perPage);
- with(array $with = []);
- columns(array $columns = ['*']);
- limit($limit = 10);
- orderBy($orderBy, $sort = 'DESC');
Usage
Create a Model
Create your model normally, but it is important to define the attributes that can be filled from the input form data.
Create a RepositoryInteface
Create a Repository
Create Service Provider
in order to bind interfaces to repository classes we should create a simple service provider to bind them
Use methods
Find all results in Repository
Find all results in Repository with pagination
Find by result by id
Showing only specific attributes of the model
Loading the Model relationships
Find by result by field name
Find by result by field
Find by result by multiple values in id
Create new entry in Repository
Update entry in Repository
Delete entry in Repository