change field to in acars table

This commit is contained in:
Nabeel Shahzad 2017-12-25 18:22:46 -06:00
parent f29a9cfdc5
commit 9916444ca2
4 changed files with 16 additions and 11 deletions

View File

@ -5,7 +5,8 @@ use Faker\Generator as Faker;
$factory->define(App\Models\Acars::class, function (Faker $faker) { $factory->define(App\Models\Acars::class, function (Faker $faker) {
return [ return [
'id' => substr($faker->unique()->sha1, 0, 12), 'id' => substr($faker->unique()->sha1, 0, 12),
'pirep_id' => '', # TODO: Fill this out 'pirep_id' => '', # fill this out by
'log' => $faker->text(200),
'lat' => $faker->latitude, 'lat' => $faker->latitude,
'lon' => $faker->longitude, 'lon' => $faker->longitude,
'heading' => $faker->numberBetween(0, 359), 'heading' => $faker->numberBetween(0, 359),

View File

@ -16,7 +16,7 @@ class CreateAcarsTables extends Migration
Schema::create('acars', function (Blueprint $table) { Schema::create('acars', function (Blueprint $table) {
$table->string('id', 12); $table->string('id', 12);
$table->string('pirep_id', 12); $table->string('pirep_id', 12);
$table->string('name', 10)->nullable(); $table->string('log')->nullable();
$table->float('lat', 7, 4)->default(0.0); $table->float('lat', 7, 4)->default(0.0);
$table->float('lon', 7, 4)->default(0.0); $table->float('lon', 7, 4)->default(0.0);
$table->unsignedInteger('heading')->nullable(); $table->unsignedInteger('heading')->nullable();

View File

@ -89,7 +89,9 @@ class PirepController extends AppBaseController
*/ */
public function acars_get($id) public function acars_get($id)
{ {
$updates = $this->acarsRepo->forPirep($this->pirepRepo->find($id)); $pirep = $this->pirepRepo->find($id);
$updates = $this->acarsRepo->forPirep($id);
return new AcarsResource($updates); return new AcarsResource($updates);
} }

View File

@ -13,9 +13,10 @@ class Acars extends BaseModel
public $fillable = [ public $fillable = [
'pirep_id', 'pirep_id',
'name', 'log',
'lat', 'lat',
'lon', 'lon',
'heading',
'altitude', 'altitude',
'vs', 'vs',
'gs', 'gs',
@ -32,6 +33,7 @@ class Acars extends BaseModel
'altitude' => 'integer', 'altitude' => 'integer',
'vs' => 'float', 'vs' => 'float',
'gs' => 'float', 'gs' => 'float',
'transponder' => 'integer',
'fuel_flow' => 'float', 'fuel_flow' => 'float',
]; ];