Skip to content

Instantly share code, notes, and snippets.

@developerdino
Last active September 7, 2017 01:21
Show Gist options
  • Save developerdino/dc369fd4f068ab9f95ca535cac9ae58b to your computer and use it in GitHub Desktop.
Save developerdino/dc369fd4f068ab9f95ca535cac9ae58b to your computer and use it in GitHub Desktop.
Using Laravel 5.5 Resources to create your own {JSON:API} formatted API - Medium Gists
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateArticlesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('articles', function (Blueprint $table) {
$table->increments('id');
$table->integer('author_id')->unsigned();
$table->string('title');
$table->timestamps();
$table->foreign('author_id')->references('id')->on('people');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('articles');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment