Package Data | |
---|---|
Maintainer Username: | nemesis1988 |
Maintainer Contact: | bondarenko.kirill@gmail.com (Bondarenko Kirill) |
Package Create Date: | 2017-01-24 |
Package Last Update: | 2019-03-04 |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-21 03:01:11 |
Package Statistics | |
---|---|
Total Downloads: | 2,434 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 0 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Package included CRUD action traits, service trait, ApiController and transformer
How to install:
composer require nemesis/laravel-rest
or add in composer.json record to require block require:
For Laravel >=5.3
```json
"nemesis/laravel-rest": "*"
Extend You controllers from Nemesis\LaravelRest\Controllers\ApiController and use action traits for him/
In Nemesis\LaravelRest\Traits\Actions* isset CRUD operations for controller
You need to set $modelClass variable in controller and using action traits
class SomeController
{
use IndexAction, ShowAction, StoreAction, UpdateAction, DestroyAction;
protected $modelClass = SomeModel::class;
}
If any of the methods that do not need it, just remove it
If you need all action, use GeneralActions
if you need filtering data by default conditions, use baseQueryFilter method on you controller:
public function baseQueryFilter($query)
{
return $query->where('owner', Auth::user()->id);
}
ItemService trait have static variable $defaultPaginate. You will change it in your controllers
Package include filter.