set fare classes on aircraft w/ overrides (no admin ui yet)

This commit is contained in:
Nabeel Shahzad
2017-06-10 18:27:19 -05:00
parent dee3503ad6
commit bf910e4549
27 changed files with 859 additions and 88 deletions

View File

@@ -2,6 +2,9 @@
$factory->define(App\Models\Fare::class, function (Faker\Generator $faker) {
return [
'code' => 'Y',
'name' => 'Economy',
'price' => '100',
'capacity' => '200',
];
});

View File

@@ -9,7 +9,7 @@ class CreateAircraftsTable extends Migration
{
Schema::create('aircraft', function (Blueprint $table) {
$table->increments('id');
$table->integer('aircraft_class_id')->unsigned();
$table->integer('aircraft_class_id')->unsigned()->nullable();
$table->string('icao');
$table->string('name');
$table->string('full_name')->nullable();

View File

@@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFaresTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('fares', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('name');
$table->float('price');
$table->float('cost')->default(0.0);
$table->integer('capacity')->default(0);
$table->string('notes')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
$table->softDeletes();
});
Schema::create('aircraft_fare', function (Blueprint $table) {
$table->increments('id');
$table->integer('aircraft_id');
$table->integer('fare_id');
$table->float('price')->nullable();
$table->float('cost')->nullable();
$table->float('capacity')->nullable();
$table->timestamps();
$table->softDeletes();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('fares');
Schema::drop('aircraft_fare');
}
}