REST API in Laravel with CRUD functionality (2019) - Setting up Controllers and Routes

preview_player
Показать описание
This tutorial demonstrate how to create controllers and setting up routes to point specific methods in that controller.

And echoing out some dummy content to make sure that the endpoints are actually pointed to correct methods in the controller.

Create Controller :

php artisan make:controller ProductController --resource

Defining Routes:

Route::resource('/products', 'ProductController');

Now open Postman and run /products url and that'll hit the index() method in ProductController.

https://{YOUR_LOCAL_HOST}/api_laravel/public/api/products

Laravel is used to build various server-side applications in the industry. Using Laravel to build APIs is a quite popular these days since it’s fairly easy with Laravel. It comes with Migrations, Pre-defined validations, Easy to manage MVC architecture and so on. And today we’re gonna learn how to build a REST API in Laravel with CRUD functionality

In this series we’re building a Simple REST API with CRUD (Create, Read, Update, Delete) functionality using Laravel. We’ll be creating an API that manages Products. So, the API will be able to Create, Read, Update and Delete products in the database.
Рекомендации по теме
Комментарии
Автор

it says ProductController not found, what should i do, help please

deepdivedevs
visit shbcf.ru