Skip to content

Commit

Permalink
+ Starter models and migrations
Browse files Browse the repository at this point in the history
  • Loading branch information
tgmcguire committed Jan 19, 2022
1 parent 4250529 commit 6f08a38
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Models/Brand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Brand extends Model
{
use HasFactory;
}
11 changes: 11 additions & 0 deletions app/Models/Journal.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Journal extends Model
{
use HasFactory;
}
11 changes: 11 additions & 0 deletions app/Models/Store.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Store extends Model
{
use HasFactory;
}
35 changes: 35 additions & 0 deletions database/migrations/2022_01_19_201843_create_brands_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateBrandsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('brands', function (Blueprint $table) {
$table->id();

$table->string('name');
$table->string('color');

$table->timestamps();
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('brands');
}
}
41 changes: 41 additions & 0 deletions database/migrations/2022_01_19_201847_create_stores_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateStoresTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('stores', function (Blueprint $table) {
$table->id();

$table->unsignedBigInteger('brand_id');
$table->unsignedBigInteger('number');
$table->string('address');
$table->string('city');
$table->string('state');
$table->string('zip_code');

$table->timestamps();

$table->foreign('brand_id')->references('id')->on('brands');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('stores');
}
}
41 changes: 41 additions & 0 deletions database/migrations/2022_01_19_201906_create_journals_table.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateJournalsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('journals', function (Blueprint $table) {
$table->id();

$table->unsignedBigInteger('store_id');
$table->date('date');
$table->unsignedBigInteger('revenue');
$table->unsignedBigInteger('food_cost');
$table->unsignedBigInteger('labor_cost');
$table->unsignedBigInteger('profit');

$table->timestamps();

$table->foreign('store_id')->references('id')->on('stores');
});
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('journals');
}
}

0 comments on commit 6f08a38

Please sign in to comment.