Skip to content

Instantly share code, notes, and snippets.

@maxheckel
Created March 11, 2017 16:42
Show Gist options
  • Select an option

  • Save maxheckel/a91866080d4182e37dc2025ade59fa27 to your computer and use it in GitHub Desktop.

Select an option

Save maxheckel/a91866080d4182e37dc2025ade59fa27 to your computer and use it in GitHub Desktop.
<?php
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
Schema::create('cart_item', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('cart_id');
$table->integer('product_id');
$table->integer('quantity');
});
Schema::create('products', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('title');
$table->text('description');
$table->float('price');
/** Whether or not the product can be purchased currently */
$table->boolean('available')->default(true);
});
Schema::create('carts', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('user_id');
$table->boolean('purchased')->default(false);
$table->timestamp('sales_date')->nullable();
$table->float('sales_price')->nullable();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment