nemesis/laravel-rest

REST actions for controllers
2,463
Install
composer require nemesis/laravel-rest
Latest Version:3.0.1
Last Updated:Mar 4, 2019
Links: GitHub  ·  Packagist
Maintainer: nemesis1988

Laravel REST actions

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": "*"

Using

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

baseQueryFilter

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);
    }

default paginate

ItemService trait have static variable $defaultPaginate. You will change it in your controllers

Filter using

Package include filter.

Related Packages

erirk/paypalpayment

laravel-paypalpayment is simple package help you process direct credit card paym...

0
gabrieloliverio/laravel5-generators

Database metadata-based generators for Laravel 5

1
doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

612,604,198 9,704
laravel/framework

The Laravel Framework.

554,918,666 34,821
laravel/tinker

Powerful REPL for the Laravel framework.

465,424,253 7,437