fix aircraft status field type in model
This commit is contained in:
@@ -44,7 +44,6 @@ class Aircraft extends Model
|
|||||||
protected $casts = [
|
protected $casts = [
|
||||||
'subfleet_id' => 'integer',
|
'subfleet_id' => 'integer',
|
||||||
'zfw' => 'float',
|
'zfw' => 'float',
|
||||||
'status' => 'integer',
|
|
||||||
'state' => 'integer',
|
'state' => 'integer',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -108,7 +108,12 @@ class ImportService extends Service
|
|||||||
|
|
||||||
// turn it into a collection and run some filtering
|
// turn it into a collection and run some filtering
|
||||||
$row = collect($row)->map(function ($val, $index) {
|
$row = collect($row)->map(function ($val, $index) {
|
||||||
return trim($val);
|
$val = trim($val);
|
||||||
|
if($val === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $val;
|
||||||
})->toArray();
|
})->toArray();
|
||||||
|
|
||||||
# Try to validate
|
# Try to validate
|
||||||
|
|||||||
@@ -555,6 +555,8 @@ class ImporterTest extends TestCase
|
|||||||
$this->assertEquals($subfleet->id, $aircraft->id);
|
$this->assertEquals($subfleet->id, $aircraft->id);
|
||||||
$this->assertEquals('A320-211', $aircraft->name);
|
$this->assertEquals('A320-211', $aircraft->name);
|
||||||
$this->assertEquals('N309US', $aircraft->registration);
|
$this->assertEquals('N309US', $aircraft->registration);
|
||||||
|
$this->assertEquals('A', $aircraft->status);
|
||||||
|
$this->assertEquals(null, $aircraft->zfw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
subfleet,iata, icao, name,registration,hex_code,status
|
subfleet,iata, icao, name,registration,hex_code,zfw,status
|
||||||
A32X,A320,320,A320-211,N309US,,
|
A32X,A320,320,A320-211,N309US,,,A
|
||||||
74X,747 400, ,,
|
74X,747 400, ,,
|
||||||
|
|||||||
|
Reference in New Issue
Block a user