guardianslabs / repository
Simple implementation of Active Repository
0.2.1
2017-09-09 10:00 UTC
Requires
- php: ~7.0|~7.1
- illuminate/database: 5.1.*|5.2.*|5.3.*
This package is not auto-updated.
Last update: 2025-03-30 03:12:20 UTC
README
Repository Is A very simple implementation for Active Repository
Install
Via Composer
$ composer require guardiansLabs/repository
Usage
create your own repository that extend the our ActiveRepository and inject your model
use App\User; use GuardiansLabs\Repository\Repositories\ActiveRepository; class UserRepository extends ActiveRepository { public function __construct() { $this->model = new User(); } }
Avilavle methods
public function setModel(Model $model); public function getModel(); /** * @return Collection */ public function findAll(); /** * @param $itemId * @return Collection */ public function findItemById($itemId); /** * @param array $data * @return Collection */ public function createNew(array $data); /** * @param $itemId * @param array $data * @return mixed */ public function update($itemId, array $data); /** * @param $itemId * @return mixed */ public function delete($itemId); /** * @param array $where * @param array $columns * @internal param array $attributes * @return Collection */ public function findWhere(array $where, $columns = ['*']); /** * @param $column * @param $values * @throws RepositoryException * @return Collection */ public function findWhereIn($column, $values);
Change log
Please see CHANGELOG for more information what has changed recently.
Contributing
Any Pull Requests are Welcome
Credits
- mustafah15
- contributors
License
The MIT License (MIT). Please see License File for more information.