flight search and pagination (in admin), schema changes to accomodate

This commit is contained in:
Nabeel Shahzad
2017-11-30 20:28:45 -06:00
parent a82b8878d3
commit e1b0b92f83
30 changed files with 554 additions and 104 deletions

View File

@@ -20,8 +20,8 @@ class CreateUsersTable extends Migration
$table->string('password');
$table->integer('airline_id')->nullable()->unsigned();
$table->integer('rank_id')->nullable()->unsigned();
$table->integer('home_airport_id')->nullable()->unsigned();
$table->integer('curr_airport_id')->nullable()->unsigned();
$table->string('home_airport_id', 5)->nullable();
$table->string('curr_airport_id', 5)->nullable();
$table->uuid('last_pirep_id')->nullable();
$table->bigInteger('flights')->unsigned()->default(0);
$table->bigInteger('flight_time')->unsigned()->default(0);

View File

@@ -10,7 +10,7 @@ class CreateAircraftsTable extends Migration
Schema::create('aircraft', function (Blueprint $table) {
$table->increments('id');
$table->integer('subfleet_id')->unsigned();
$table->integer('airport_id')->unsigned()->nullable();
$table->string('airport_id', 5)->nullable();
$table->string('hex_code', 10)->nullable();
$table->string('name', 50);
$table->string('registration', 10)->nullable();

View File

@@ -14,19 +14,17 @@ class CreateAirportsTable extends Migration
public function up()
{
Schema::create('airports', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('icao', 5)->unique();
// $table->bigIncrements('id');
$table->string('id', 5)->primary();
$table->string('icao', 5);
$table->string('name', 50);
$table->string('location', 50)->nullable();
$table->string('country', 50)->nullable();
$table->double('fuel_100ll_cost', 19, 2)->default(0);
$table->double('fuel_jeta_cost', 19, 2)->default(0);
$table->double('fuel_mogas_cost', 19, 2)->default(0);
$table->float('lat', 7, 4)->default(0.0);
$table->float('lon', 7, 4)->default(0.0);
$table->timestamps();
$table->index('icao');
$table->float('lat', 7, 4)->default(0.0)->nullable();
$table->float('lon', 7, 4)->default(0.0)->nullable();
});
}

View File

@@ -19,9 +19,9 @@ class CreateFlightsTable extends Migration
$table->string('flight_number', 10);
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->integer('dpt_airport_id')->unsigned();
$table->integer('arr_airport_id')->unsigned();
$table->integer('alt_airport_id')->unsigned()->nullable();
$table->string('dpt_airport_id', 5);
$table->string('arr_airport_id', 5);
$table->string('alt_airport_id', 5)->nullable();
$table->text('route')->nullable();
$table->text('dpt_time', 10)->nullable();
$table->text('arr_time', 10)->nullable();

View File

@@ -22,8 +22,8 @@ class CreatePirepsTable extends Migration
$table->string('flight_number', 10)->nullable();
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->integer('dpt_airport_id')->unsigned();
$table->integer('arr_airport_id')->unsigned();
$table->string('dpt_airport_id', 5)->unsigned();
$table->string('arr_airport_id', 5)->unsigned();
$table->double('flight_time', 19, 2)->unsigned();
$table->double('gross_weight', 19, 2)->nullable();
$table->double('fuel_used', 19, 2)->nullable();

View File

@@ -13,6 +13,7 @@ class DatabaseSeeder extends Seeder
{
$env = App::environment();
$path = database_path('seeds/'.$env.'.yml');
print "Seeding seeds/$env.yml";
if(!file_exists($path)) {
$path = database_path('seeds/prod.yml');
}

View File

@@ -14,8 +14,8 @@ users:
password: admin
rank_id: 1
airline_id: 1
home_airport_id: 1
curr_airport_id: 2
home_airport_id: KAUS
curr_airport_id: KJFK
flights: 1
flight_time: 43200
created_at: now
@@ -27,8 +27,8 @@ users:
password: admin
rank_id: 1
airline_id: 1
home_airport_id: 2
curr_airport_id: 2
home_airport_id: KJFK
curr_airport_id: KJFK
flights: 1
flight_time: 43200
created_at: now
@@ -40,8 +40,8 @@ users:
password: admin
rank_id: 1
airline_id: 1
home_airport_id: 2
curr_airport_id: 2
home_airport_id: KJFK
curr_airport_id: KAUS
flights: 1
flight_time: 43200
created_at: now
@@ -88,19 +88,19 @@ airlines:
updated_at: now
airports:
- id: 1
- id: KAUS
icao: KAUS
name: Austin-Bergstrom
location: Austin, Texas, USA
lat: 30.1945278
lon: -97.6698889
- id: 2
- id: KJFK
icao: KJFK
name: John F Kennedy
location: New York, New York, USA
lat: 40.6399257
lon: -73.7786950
- id: 3
- id: EGLL
icao: EGLL
name: London Heathrow
location: London, England
@@ -186,27 +186,123 @@ flights:
- id: flightid_1
airline_id: 1
flight_number: 100
dpt_airport_id: 1
arr_airport_id: 2
dpt_airport_id: KAUS
arr_airport_id: KJFK
route: KAUS KJFK
dpt_time: 6PM CST
arr_time: 11PM EST
- id: flightid_2
airline_id: 1
flight_number: 101
dpt_airport_id: 2
arr_airport_id: 1
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 9AM EST
arr_time: 12PM CST
route: KJFK KAUS
- id: flightid_3
airline_id: 1
flight_number: 200
dpt_airport_id: 2
arr_airport_id: 3
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 9AM EST
arr_time: 12PM CST
route: KJFK KAUS
- id: flightid_4
airline_id: 1
flight_number: 201
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 10AM EST
arr_time: 1PM CST
route: KJFK KAUS
- id: flightid_5
airline_id: 1
flight_number: 202
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 11AM EST
arr_time: 2PM CST
route: KJFK KAUS
- id: flightid_6
airline_id: 1
flight_number: 203
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 12PM EST
arr_time: 3PM CST
route: KJFK KAUS
- id: flightid_7
airline_id: 1
flight_number: 204
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 1PM EST
arr_time: 4PM CST
route: KJFK KAUS
- id: flightid_8
airline_id: 1
flight_number: 205
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 2PM EST
arr_time: 5PM CST
route: KJFK KAUS
- id: flightid_9
airline_id: 1
flight_number: 206
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 3PM EST
arr_time: 6PM CST
route: KJFK KAUS
- id: flightid_10
airline_id: 1
flight_number: 207
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 4PM EST
arr_time: 7PM CST
route: KJFK KAUS
- id: flightid_11
airline_id: 1
flight_number: 208
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 5PM EST
arr_time: 8PM CST
route: KJFK KAUS
- id: flightid_12
airline_id: 1
flight_number: 209
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 6PM EST
arr_time: 9PM CST
route: KJFK KAUS
- id: flightid_13
airline_id: 1
flight_number: 210
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 7PM EST
arr_time: 10PM CST
route: KJFK KAUS
- id: flightid_14
airline_id: 1
flight_number: 211
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 8PM EST
arr_time: 11PM CST
route: KJFK KAUS
- id: flightid_15
airline_id: 1
flight_number: 212
dpt_airport_id: KJFK
arr_airport_id: KAUS
dpt_time: 9PM EST
arr_time: 12AM CST
route: KJFK KAUS
flight_fields:
- id: 1
@@ -232,8 +328,8 @@ pireps:
airline_id: 1
flight_id: flightid_1
aircraft_id: 1
dpt_airport_id: 1
arr_airport_id: 2
dpt_airport_id: KAUS
arr_airport_id: KJFK
flight_time: 21600 # 6 hours
status: -1
notes: just a pilot report
@@ -242,8 +338,8 @@ pireps:
airline_id: 1
flight_id: flightid_2
aircraft_id: 1
dpt_airport_id: 2
arr_airport_id: 1
dpt_airport_id: KJFK
arr_airport_id: KAUS
flight_time: 21600 # 6 hours
status: -1
notes: just a pilot report