Download the PHP package nalingia/laravel-repositories without Composer
On this page you can find all versions of the php package nalingia/laravel-repositories. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nalingia/laravel-repositories
More information about nalingia/laravel-repositories
Files in nalingia/laravel-repositories
Package laravel-repositories
Short Description A Laravel package for the Repository Design Pattern.
License MIT
Informations about the package laravel-repositories
A Laravel package for the Repository design pattern
Repositories is a simple package to simplify the creation of scaffolding code when using the Repository Design Pattern. It adds an artisan command which creates the repository and the related contract.
Installation
You can install the package via composer:
Then you have to add the related Service Provider to the providers
configuration array in config/app.php
:
Usage
The package provides an additional artisan command called make:repository
which accepts as only parameter the model's class name.
For instance, if you need to create a repository of users you can type:
The command will create both the repository and the related contract in app/Repositories
and app/Repositories/Contracts
folders, respectively.
Default folders and namespaces can be changed
Available API
The generated repositories will inherit from Nalingia\Repositories\AbstractEloquentRepository
which provides a bunch of useful and general purpose methods:
-
Get all models:
-
Get model having the given id:
-
Get the first model having
$key
attribute equals to$value
: -
Get all models having
$key
attribute equals to$value
: -
Get first model matching
$where
clauses: -
Get all models matching
$where
clauses: -
Get paginated models:
-
Create a new model:
-
Update a model:
-
Delete a model:
-
Truncate the table related to the model:
- Get all models having in :
You can contribute to the common methods by proposing a pull request.
Settings
If you need to change the default command settings, you can publish the repositories.php
configuration file using the command:
Change log
Please, see CHANGELOG for more information about what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Testing
You can run the tests with:
or
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-repositories with dependencies
illuminate/support Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0|~6.0
illuminate/filesystem Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0|~6.0
lstrojny/functional-php Version ^1.9