Apply fixes from StyleCI

This commit is contained in:
Nabeel Shahzad
2018-08-26 16:40:04 +00:00
committed by StyleCI Bot
parent 20f46adbc4
commit 9596d88b48
407 changed files with 4032 additions and 3286 deletions

View File

@@ -4,11 +4,11 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Aircraft::class, function (Faker $faker) {
return [
'id' => null,
'subfleet_id' => function () {
'id' => null,
'subfleet_id' => function () {
return factory(App\Models\Subfleet::class)->create()->id;
},
'airport_id' => function () {
'airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'iata' => $faker->unique()->text(5),

View File

@@ -3,23 +3,23 @@
use Faker\Generator as Faker;
use Hashids\Hashids;
/**
/*
* Add any number of airports. Don't really care if they're real or not
*/
$factory->define(App\Models\Airline::class, function (Faker $faker) {
return [
'id' => null,
'icao' => function (array $apt) use ($faker) {
'id' => null,
'icao' => function (array $apt) use ($faker) {
$hashids = new Hashids(microtime(), 5);
$mt = str_replace('.', '', microtime(true));
return $hashids->encode($mt);
},
'iata' => function (array $apt) {
'iata' => function (array $apt) {
return $apt['icao'];
},
'name' => $faker->sentence(3),
'country' => $faker->country,
'active' => 1
'active' => 1,
];
});

View File

@@ -2,7 +2,7 @@
use Faker\Generator as Faker;
/**
/*
* Add any number of airports. Don't really care if they're real or not
*/
$factory->define(App\Models\Airport::class, function (Faker $faker) {
@@ -17,10 +17,10 @@ $factory->define(App\Models\Airport::class, function (Faker $faker) {
return $string;
},
'icao' => function (array $apt) {
'icao' => function (array $apt) {
return $apt['id'];
},
'iata' => function (array $apt) {
'iata' => function (array $apt) {
return $apt['id'];
},
'name' => $faker->sentence(3),

View File

@@ -4,11 +4,11 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Fare::class, function (Faker $faker) {
return [
'id' => null,
'code' => $faker->unique()->text(50),
'name' => $faker->text(50),
'price' => $faker->randomFloat(2, 100, 1000),
'cost' => function (array $fare) {
'id' => null,
'code' => $faker->unique()->text(50),
'name' => $faker->text(50),
'price' => $faker->randomFloat(2, 100, 1000),
'cost' => function (array $fare) {
return round($fare['price'] / 2);
},
'capacity' => $faker->randomFloat(0, 20, 500),

View File

@@ -2,13 +2,12 @@
/**
* Create flights
*/
use Faker\Generator as Faker;
$factory->define(App\Models\Flight::class, function (Faker $faker) {
return [
'id' => $faker->unique()->numberBetween(10, 10000000),
'airline_id' => function () {
'id' => $faker->unique()->numberBetween(10, 10000000),
'airline_id' => function () {
return factory(App\Models\Airline::class)->create()->id;
},
'flight_number' => $faker->unique()->numberBetween(10, 1000000),
@@ -23,20 +22,20 @@ $factory->define(App\Models\Flight::class, function (Faker $faker) {
'alt_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'distance' => $faker->numberBetween(0, 3000),
'route' => null,
'level' => 0,
'dpt_time' => $faker->time(),
'arr_time' => $faker->time(),
'flight_time' => $faker->numberBetween(60, 360),
'has_bid' => false,
'active' => true,
'visible' => true,
'days' => 0,
'start_date' => null,
'end_date' => null,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function (array $flight) {
'distance' => $faker->numberBetween(0, 3000),
'route' => null,
'level' => 0,
'dpt_time' => $faker->time(),
'arr_time' => $faker->time(),
'flight_time' => $faker->numberBetween(60, 360),
'has_bid' => false,
'active' => true,
'visible' => true,
'days' => 0,
'start_date' => null,
'end_date' => null,
'created_at' => $faker->dateTimeBetween('-1 week', 'now'),
'updated_at' => function (array $flight) {
return $flight['created_at'];
},
];

View File

@@ -8,10 +8,10 @@ $factory->define(App\Models\JournalTransactions::class, function (Faker $faker)
'journal_id' => function () {
return factory(App\Models\Journal::class)->create()->id;
},
'credit' => $faker->numberBetween(100, 10000),
'debit' => $faker->numberBetween(100, 10000),
'currency' => 'USD',
'memo' => $faker->sentence(6),
'post_date' => \Carbon\Carbon::now(),
'credit' => $faker->numberBetween(100, 10000),
'debit' => $faker->numberBetween(100, 10000),
'currency' => 'USD',
'memo' => $faker->sentence(6),
'post_date' => \Carbon\Carbon::now(),
];
});

View File

@@ -5,7 +5,7 @@ use Faker\Generator as Faker;
$factory->define(App\Models\News::class, function (Faker $faker) {
return [
'id' => null,
'user_id' => function() {
'user_id' => function () {
return factory(App\Models\User::class)->create()->id;
},
'subject' => $faker->text(),

View File

@@ -3,32 +3,32 @@
use Carbon\Carbon;
use Faker\Generator as Faker;
/**
/*
* Create a new PIREP
*/
$factory->define(App\Models\Pirep::class, function (Faker $faker) {
return [
'id' => $faker->unique()->numberBetween(10, 10000000),
'airline_id' => function () {
'id' => $faker->unique()->numberBetween(10, 10000000),
'airline_id' => function () {
return factory(App\Models\Airline::class)->create()->id;
},
'user_id' => function () {
'user_id' => function () {
return factory(App\Models\User::class)->create()->id;
},
'aircraft_id' => function () {
'aircraft_id' => function () {
return factory(App\Models\Aircraft::class)->create()->id;
},
'flight_number' => function (array $pirep) {
'flight_number' => function (array $pirep) {
return factory(App\Models\Flight::class)->create([
'airline_id' => $pirep['airline_id']
'airline_id' => $pirep['airline_id'],
])->flight_number;
},
'route_code' => null,
'route_leg' => null,
'dpt_airport_id' => function () {
'route_code' => null,
'route_leg' => null,
'dpt_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'arr_airport_id' => function () {
'arr_airport_id' => function () {
return factory(App\Models\Airport::class)->create()->id;
},
'level' => $faker->numberBetween(20, 400),
@@ -43,15 +43,15 @@ $factory->define(App\Models\Pirep::class, function (Faker $faker) {
'block_off_time' => function (array $pirep) {
return $pirep['block_on_time']->subMinutes($pirep['flight_time']);
},
'route' => $faker->text(200),
'notes' => $faker->text(200),
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
'source_name' => 'Test Factory',
'state' => PirepState::PENDING,
'status' => PirepStatus::SCHEDULED,
'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => function (array $pirep) {
'route' => $faker->text(200),
'notes' => $faker->text(200),
'source' => $faker->randomElement([PirepSource::MANUAL, PirepSource::ACARS]),
'source_name' => 'Test Factory',
'state' => PirepState::PENDING,
'status' => PirepStatus::SCHEDULED,
'submitted_at' => Carbon::now('UTC')->toDateTimeString(),
'created_at' => Carbon::now('UTC')->toDateTimeString(),
'updated_at' => function (array $pirep) {
return $pirep['created_at'];
},
];

View File

@@ -4,8 +4,8 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Subfleet::class, function (Faker $faker) {
return [
'id' => null,
'airline_id' => function () {
'id' => null,
'airline_id' => function () {
return factory(App\Models\Airline::class)->create()->id;
},
'name' => $faker->unique()->text(50),

View File

@@ -7,12 +7,12 @@ $factory->define(App\Models\User::class, function (Faker $faker) {
static $password;
return [
'id' => null,
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = Hash::make('secret'),
'api_key' => $faker->sha1,
'airline_id' => function () {
'id' => null,
'name' => $faker->name,
'email' => $faker->safeEmail,
'password' => $password ?: $password = Hash::make('secret'),
'api_key' => $faker->sha1,
'airline_id' => function () {
return factory(App\Models\Airline::class)->create()->id;
},
'rank_id' => 1,

View File

@@ -30,7 +30,7 @@ class CreateSettingsTable extends Migration
$table->timestamps();
});
/**
/*
* Initial default settings
*/
@@ -122,7 +122,7 @@ class CreateSettingsTable extends Migration
'description' => 'The units for temperature',
]);
/**
/*
* ACARS Settings
*/
@@ -151,7 +151,7 @@ class CreateSettingsTable extends Migration
'description' => 'Initial zoom level on the map',
]);
/**
/*
* BIDS
*/
@@ -179,7 +179,7 @@ class CreateSettingsTable extends Migration
'description' => 'Number of hours to expire bids after',
]);
/**
/*
* PIREPS
*/
@@ -223,7 +223,7 @@ class CreateSettingsTable extends Migration
'description' => 'When a PIREP is accepted, remove the bid, if it exists',
]);
/**
/*
* PILOTS
*/

View File

@@ -8,7 +8,7 @@ class RolesPermissionsTables extends Migration
/**
* Run the migrations.
*
* @return void
* @return void
*/
public function up()
{
@@ -67,7 +67,7 @@ class RolesPermissionsTables extends Migration
$table->primary(['permission_id', 'role_id']);
});
# create a default user/role
// create a default user/role
$roles = [
[
'id' => 1,
@@ -77,7 +77,7 @@ class RolesPermissionsTables extends Migration
[
'id' => 2,
'name' => 'user',
'display_name' => 'Pilot'
'display_name' => 'Pilot',
],
];
@@ -87,7 +87,7 @@ class RolesPermissionsTables extends Migration
/**
* Reverse the migrations.
*
* @return void
* @return void
*/
public function down()
{

View File

@@ -57,7 +57,7 @@ class CreateFlightTables extends Migration
$table->primary(['flight_id', 'fare_id']);
});
/**
/*
* Hold a master list of fields
*/
Schema::create('flight_fields', function (Blueprint $table) {
@@ -66,7 +66,7 @@ class CreateFlightTables extends Migration
$table->string('slug', 50)->nullable();
});
/**
/*
* The values for the actual fields
*/
Schema::create('flight_field_values', function (Blueprint $table) {

View File

@@ -39,7 +39,7 @@ class CreateRanksTable extends Migration
'hours' => 0,
'acars_base_pay_rate' => 50,
'manual_base_pay_rate' => 25,
]
],
];
$this->addData('ranks', $ranks);

View File

@@ -13,7 +13,7 @@ class CreateNavdataTables extends Migration
*/
public function up()
{
/**
/*
* See for defs, modify/update based on this
* https://github.com/skiselkov/openfmc/blob/master/airac.h
*/

View File

@@ -19,11 +19,11 @@ class CreateAwardsTable extends Migration
$table->text('description')->nullable();
$table->text('image_url')->nullable();
# ref fields are expenses tied to some model object
# EG, the airports has an internal expense for gate costs
// ref fields are expenses tied to some model object
// EG, the airports has an internal expense for gate costs
$table->string('ref_model')->nullable();
$table->text('ref_model_params')->nullable();
#$table->string('ref_model_id', 36)->nullable();
//$table->string('ref_model_id', 36)->nullable();
$table->timestamps();

View File

@@ -19,8 +19,8 @@ class CreateExpensesTable extends Migration
$table->boolean('multiplier')->nullable()->default(0);
$table->boolean('active')->nullable()->default(true);
# ref fields are expenses tied to some model object
# EG, the airports has an internal expense for gate costs
// ref fields are expenses tied to some model object
// EG, the airports has an internal expense for gate costs
$table->string('ref_model')->nullable();
$table->string('ref_model_id', 36)->nullable();

View File

@@ -1,13 +1,14 @@
<?php
use App\Interfaces\Migration;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFilesTable extends Migration
{
/**
* Create the files table. Acts as a morphable
*
* @return void
*/
public function up()

View File

@@ -6,6 +6,7 @@ class DatabaseSeeder extends Seeder
{
/**
* Map these other environments to a specific seed file
*
* @var array
*/
public static $seed_mapper = [
@@ -16,6 +17,7 @@ class DatabaseSeeder extends Seeder
/**
* Run the database seeds.
*
* @throws Exception
*/
public function run()