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:
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
In the
app/database/migrations
directory, find the file similar to2012_12_01_222821_create_shows_table.php
and create the schema for our table as follows:<?php use Illuminate\Database\Migrations\Migration; class CreateShowsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('shows', function...