davidhoeck / lararest
The simplest way to create CRUD REST API routes.
1.2.0
2017-03-23 12:44 UTC
Requires
- php: >=5.6.4
- laravel/framework: >=5.2
- nabil1337/case-helper: ^0.1.0
This package is not auto-updated.
Last update: 2024-11-10 01:56:25 UTC
README
Keep your API routes file clean and generate your CRUD routes via LaraRest.
STEP 1
Install LaraRest via Composer.
composer require davidhoeck/lararest
STEP 2
Create your eloquent models.
STEP 3
Go to your api.php
in the routes
folder.
STEP 4
Initialize the RestApiProvider
. Just paste the following lines of code,
at the top of your api.php
file.
/** @var \DavidHoeck\LaraRest\RestApiProvider $apiProvider */
$apiProvider = new \DavidHoeck\LaraRest\RestApiProvider();
STEP 5
Hook your models into the provider. Add every model your want your CRUD REST routes to be generate.
$apiProvider->addModel( new User() );
EXAMPLE
The following line of code ...
$apiProvider->addModel( new User() );
... produces these routes.