O'Reilly logo

Laravel Application Development Cookbook by Terry Matula

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building a RESTful API with routes

A common need for a modern web application is having an API that third-parties can run queries against. Since Laravel is built with RESTful patterns as a focus, it's quite easy to build a full API with very little work.

Getting ready

For this recipe, we need a standard Laravel installation with a properly configured MySQL database tied into our application.

How to do it...

To complete this recipe, follow these steps:

  1. Open the command line, go to the root directory of the Laravel installation, and create a migration for our table using the following:
    php artisan migrate:make create_shows_table
  2. In the app/database/migrations directory, find the file similar to 2012_12_01_222821_create_shows_table.php and create the schema ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required