Add aircraft ident to API response
This commit is contained in:
parent
78fd8367a1
commit
60cec870f6
@ -4,6 +4,16 @@ namespace App\Http\Resources;
|
||||
|
||||
use App\Contracts\Resource;
|
||||
|
||||
/**
|
||||
* @mixin \App\Models\Aircraft
|
||||
*/
|
||||
class Aircraft extends Resource
|
||||
{
|
||||
public function toArray($request)
|
||||
{
|
||||
$res = parent::toArray($request);
|
||||
$res['ident'] = $this->ident;
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
@ -279,6 +279,9 @@ class ApiTest extends TestCase
|
||||
}
|
||||
|
||||
$this->assertCount($size, $subfleet['aircraft']);
|
||||
foreach ($subfleet['aircraft'] as $aircraft) {
|
||||
$this->assertNotEmpty($aircraft['ident']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -314,6 +317,7 @@ class ApiTest extends TestCase
|
||||
|
||||
$this->assertEquals($body['id'], $aircraft->id);
|
||||
$this->assertEquals($body['name'], $aircraft->name);
|
||||
$this->assertNotEmpty($body['ident']);
|
||||
$this->assertEquals($body['mtow'], $aircraft->mtow);
|
||||
$this->assertEquals($body['zfw'], $aircraft->zfw);
|
||||
|
||||
@ -325,6 +329,9 @@ class ApiTest extends TestCase
|
||||
$this->assertEquals($body['mtow'], $aircraft->mtow);
|
||||
$this->assertEquals($body['zfw'], $aircraft->zfw);
|
||||
|
||||
$this->assertNotEmpty($body['ident']);
|
||||
$this->assertEquals($body['ident'], $aircraft->ident);
|
||||
|
||||
$resp = $this->get('/api/fleet/aircraft/'.$aircraft->id.'?icao='.$aircraft->icao);
|
||||
$body = $resp->json()['data'];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user