Simple REST API with Laravel

January 23, 2018

Prerequisites

I assume that you have following knowledge to follow this tutorial

  • A basic knowledge of Laravel development.
  • A basic knowledge of how REST APIs work.
  • You should have installed Laravel in your computer

First you can create the model with the resource controller


Now you can migrate the database file


Now you can create the API Resouce for the Product

php artisan make:resource ProductResource

This will create the ProductResource.php file at App\Http\Resources\Product