Restful API

It uses stateless protocol for communication between applications. There are four types of protocol which are also known HTTP verbs. They are GET, POST, PUT and DELETE. They are setup in resources which are called endpoints and these resources are setup in such manner that based upon HTTP verb proper response is thrown.
 

Building RESTful APIs in Laravel

This post will have all the links of step by step implementation of restful apis using Laravel in this site...


Seeding Poll data

Step 01: running artisan command to create poll factory, seeder, migration and model files php artisan make:model Poll -mfs Step...


Browsing Poll records in restful api

Step 01: making PollController with artisan command php artisan make:controller PollController Step 02: setting up route for index method in...


Reading a Poll record with validation in restful api

Step 01: Setting up route for show() method in PollController in routes/api.php Route::get( '/polls', [PollController::class,'index']); Step 02: Adding show() method...


Adding a Poll record with validation in restful api

Step 01: Setting up route for store() method in PollController in routes/api.php Route::post( '/polls', [PollController::class,'store']); Step 02: Adding store() method...


Editing a Poll record with validation

Step 01: setting up route for store() method in PollController in routes/api.php Route::put( '/polls/{id}', [PollController::class,'update']); Step 02: adding update() method...


Deleting a Poll record with validation

Step 01: setting up route for delete() method in PollController in routes/api.php Route::delete( '/polls/{id}', [PollController::class,'delete']); Step 02: adding delete() method...


Searching Poll records with query string and using eloquent when

We will be changing index() method like below of PollController for this purpose //In PollController.phppublic function index() { //dd(request('search_title')); $polls...


Using transformers to transform api response data

Sometimes our api response data need to be transferred in certain way to achive our desired need. For example, formatting...


Seeding Question data for a poll

Step 01: running artisan command to create question factory, seeder, migration and model files php artisan make:model Question -mfs Step...