some refactoring for tests and adding some tables
This commit is contained in:
10
database/factories/AircraftClassFactory.php
Normal file
10
database/factories/AircraftClassFactory.php
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
$factory->define(App\Models\AircraftClass::class, function (Faker\Generator $faker) {
|
||||
return [
|
||||
'id' => 1,
|
||||
'code' => 'H',
|
||||
'name' => 'Heavy',
|
||||
'notes' => 'Heavy aircraft',
|
||||
];
|
||||
});
|
||||
@@ -1,16 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Model Factories
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may define all of your model factories. Model factories give
|
||||
| you a convenient way to create models for testing and seeding your
|
||||
| database. Just tell the factory how a default model should look.
|
||||
|
|
||||
*/
|
||||
|
||||
$factory->define(App\User::class, function (Faker\Generator $faker) {
|
||||
static $password;
|
||||
|
||||
|
||||
@@ -9,18 +9,37 @@ class CreateAircraftsTable extends Migration
|
||||
{
|
||||
Schema::create('aircraft', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->integer('aircraft_class_id')->unsigned();
|
||||
$table->string('icao');
|
||||
$table->string('name');
|
||||
$table->string('full_name')->nullable();
|
||||
$table->string('registration')->nullable();
|
||||
$table->boolean('active');
|
||||
$table->string('tail_number')->nullable();
|
||||
$table->string('cargo_capacity')->nullable();
|
||||
$table->string('fuel_capacity')->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index('icao');
|
||||
$table->unique('registration');
|
||||
});
|
||||
|
||||
Schema::create('aircraft_classes', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('code');
|
||||
$table->string('name');
|
||||
$table->string('notes')->nullable();
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->index('code');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::drop('aircraft');
|
||||
Schema::drop('aircraft_classes');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "id",
|
||||
"dbType": "increments",
|
||||
"htmlType": "",
|
||||
"validations": "",
|
||||
"searchable": false,
|
||||
"fillable": false,
|
||||
"primary": true,
|
||||
"inForm": false,
|
||||
"inIndex": false
|
||||
},
|
||||
{
|
||||
"name": "icao",
|
||||
"dbType": "string",
|
||||
"htmlType": "text",
|
||||
"validations": "required|max:4",
|
||||
"searchable": true
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"dbType": "string",
|
||||
"htmlType": "text",
|
||||
"validations": "required",
|
||||
"searchable": true
|
||||
},
|
||||
{
|
||||
"name": "enabled",
|
||||
"dbType": "boolean",
|
||||
"htmlType": "checkbox",
|
||||
"validations": "",
|
||||
"searchable": false
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"dbType": "timestamp",
|
||||
"htmlType": "",
|
||||
"validations": "",
|
||||
"searchable": false,
|
||||
"fillable": false,
|
||||
"primary": false,
|
||||
"inForm": false,
|
||||
"inIndex": false
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"dbType": "timestamp",
|
||||
"htmlType": "",
|
||||
"validations": "",
|
||||
"searchable": false,
|
||||
"fillable": false,
|
||||
"primary": false,
|
||||
"inForm": false,
|
||||
"inIndex": false
|
||||
}
|
||||
]
|
||||
@@ -1,56 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name": "id",
|
||||
"dbType": "increments",
|
||||
"htmlType": "",
|
||||
"validations": "",
|
||||
"searchable": false,
|
||||
"fillable": false,
|
||||
"primary": true,
|
||||
"inForm": false,
|
||||
"inIndex": false
|
||||
},
|
||||
{
|
||||
"name": "code",
|
||||
"dbType": "string",
|
||||
"htmlType": "text",
|
||||
"validations": "required",
|
||||
"searchable": true
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"dbType": "string",
|
||||
"htmlType": "text",
|
||||
"validations": "required",
|
||||
"searchable": true
|
||||
},
|
||||
{
|
||||
"name": "enabled",
|
||||
"dbType": "boolean",
|
||||
"htmlType": "checkbox",
|
||||
"validations": "",
|
||||
"searchable": false
|
||||
},
|
||||
{
|
||||
"name": "created_at",
|
||||
"dbType": "timestamp",
|
||||
"htmlType": "",
|
||||
"validations": "",
|
||||
"searchable": false,
|
||||
"fillable": false,
|
||||
"primary": false,
|
||||
"inForm": false,
|
||||
"inIndex": false
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"dbType": "timestamp",
|
||||
"htmlType": "",
|
||||
"validations": "",
|
||||
"searchable": false,
|
||||
"fillable": false,
|
||||
"primary": false,
|
||||
"inForm": false,
|
||||
"inIndex": false
|
||||
}
|
||||
]
|
||||
18
database/seeds/AircraftClassesSeeder.php
Normal file
18
database/seeds/AircraftClassesSeeder.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeds;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class AircraftClassesSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,6 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// $this->call(UsersTableSeeder::class);
|
||||
// $this->call(AircraftClassesSeeder::class);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user