Skip to content

Instantly share code, notes, and snippets.

@silverly
Last active August 29, 2015 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silverly/e768347927b0da562d24 to your computer and use it in GitHub Desktop.
Save silverly/e768347927b0da562d24 to your computer and use it in GitHub Desktop.
Tables
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* http://laravel.com/docs/schema
*/
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('products', function($table)
{
$table->increments('id');
$table->string('name', 128);
$table->string('description', 1000)->nullable();
$table->float('cost');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('products');
}
}
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* http://laravel.com/docs/schema
*/
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('shops', function($table)
{
$table->increments('id');
$table->string('name', 128);
$table->string('description', 1000)->nullable();
$table->foreign('user_id')->references('id')->on('users');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('shops');
}
}
@KureHumanite
Copy link

What are you doing here? I'm good at php, i would love to help with whatever you might want to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment