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) {
return [
'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,
'lon' => $faker->longitude,
'heading' => $faker->numberBetween(0, 359),

View File

@ -16,7 +16,7 @@ class CreateAcarsTables extends Migration
Schema::create('acars', function (Blueprint $table) {
$table->string('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('lon', 7, 4)->default(0.0);
$table->unsignedInteger('heading')->nullable();

View File

@ -89,7 +89,9 @@ class PirepController extends AppBaseController
*/
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);
}

View File

@ -13,9 +13,10 @@ class Acars extends BaseModel
public $fillable = [
'pirep_id',
'name',
'log',
'lat',
'lon',
'heading',
'altitude',
'vs',
'gs',
@ -26,13 +27,14 @@ class Acars extends BaseModel
];
public $casts = [
'lat' => 'float',
'lon' => 'float',
'heading' => 'integer',
'altitude' => 'integer',
'vs' => 'float',
'gs' => 'float',
'fuel_flow' => 'float',
'lat' => 'float',
'lon' => 'float',
'heading' => 'integer',
'altitude' => 'integer',
'vs' => 'float',
'gs' => 'float',
'transponder' => 'integer',
'fuel_flow' => 'float',
];
/**