Add some stats info for airlines and the stats table #108
This commit is contained in:
@@ -21,6 +21,8 @@ class CreateAirlinesTable extends Migration
|
||||
$table->string('country', 2)->nullable();
|
||||
$table->string('logo', 255)->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
$table->unsignedBigInteger('total_flights')->default(0);
|
||||
$table->unsignedBigInteger('total_time')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('icao');
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
use App\Models\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
|
||||
class CreateStatsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('stats', function (Blueprint $table) {
|
||||
$table->string('id');
|
||||
$table->string('value');
|
||||
$table->unsignedInteger('order');
|
||||
$table->string('type')->nullable();
|
||||
$table->string('description')->nullable();
|
||||
|
||||
$table->primary('id');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
$this->addCounterGroups([
|
||||
'flights' => 1,
|
||||
]);
|
||||
|
||||
/**
|
||||
* Initial default settings
|
||||
*/
|
||||
$stats = [
|
||||
[
|
||||
'id' => $this->formatSettingId('flights.total_flights'),
|
||||
'order' => $this->getNextOrderNumber('flights'),
|
||||
'value' => 0,
|
||||
'type' => 'int',
|
||||
'description' => 'Total number of flights in the VA',
|
||||
],
|
||||
[
|
||||
'id' => $this->formatSettingId('flights.total_time'),
|
||||
'order' => $this->getNextOrderNumber('flights'),
|
||||
'value' => 0,
|
||||
'type' => 'int',
|
||||
'description' => 'Total number of hours in the VA',
|
||||
],
|
||||
];
|
||||
|
||||
$this->addData('stats', $stats);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,8 @@ class Airline extends BaseModel
|
||||
'name',
|
||||
'logo',
|
||||
'country',
|
||||
'total_flights',
|
||||
'total_time',
|
||||
'active',
|
||||
];
|
||||
|
||||
@@ -25,7 +27,9 @@ class Airline extends BaseModel
|
||||
* @var array
|
||||
*/
|
||||
protected $casts = [
|
||||
'active' => 'boolean',
|
||||
'total_flights' => 'int',
|
||||
'total_time' => 'int',
|
||||
'active' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user