1. Go to this page and download the library: Download izupet/laravel-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
izupet / laravel-api example snippets
Izupet\Api\Providers\ApiServiceProvider::class
use App\Http\Requests\CarsRequest;
use Izupet\Api\Traits\ApiResponse;
class CarsController extends Controller
{
use ApiResponse;
public function index(CarsRequest $request)
{
//
return $this->respond('Ok', 200, []);
}
}
public function create(array $input)
{
return $this->car->apiCreate('fields', $input);
}
public function update(array $input, \App\Car $car)
{
return $car->apiUpdate('fields', 'relations', $input);
}
public function delete(\App\Car $car)
{
return $car->apiDelete();
}