Add pirep comments and subfleets fares #118
This commit is contained in:
parent
f9efa81bb4
commit
9964eb63fb
@ -51,9 +51,9 @@ class FleetController extends RestController
|
||||
$where['id'] = $id;
|
||||
}
|
||||
|
||||
$all_aircraft = $this->aircraftRepo->all();
|
||||
#$all_aircraft = $this->aircraftRepo->all();
|
||||
$aircraft = $this->aircraftRepo
|
||||
->with(['subfleet'])
|
||||
->with(['subfleet', 'subfleet.fares'])
|
||||
->findWhere($where)
|
||||
->first();
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Api;
|
||||
|
||||
use App\Models\PirepComment;
|
||||
use Log;
|
||||
use Auth;
|
||||
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
||||
@ -20,6 +21,7 @@ use App\Repositories\AcarsRepository;
|
||||
use App\Repositories\PirepRepository;
|
||||
|
||||
use App\Http\Resources\Pirep as PirepResource;
|
||||
use App\Http\Resources\PirepComment as PirepCommentResource;
|
||||
use App\Http\Resources\AcarsRoute as AcarsRouteResource;
|
||||
|
||||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
|
||||
@ -328,6 +330,44 @@ class PirepController extends RestController
|
||||
return $this->message($count . ' logs added', $count);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new comment
|
||||
* @param $id
|
||||
* @param Request $request
|
||||
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
|
||||
*/
|
||||
public function comments_get($id, Request $request)
|
||||
{
|
||||
$pirep = $this->pirepRepo->find($id);
|
||||
return PirepCommentResource::collection($pirep->comments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new comment
|
||||
* @param $id
|
||||
* @param Request $request
|
||||
* @return PirepCommentResource
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException
|
||||
*/
|
||||
public function comments_post($id, Request $request)
|
||||
{
|
||||
$pirep = $this->pirepRepo->find($id);
|
||||
if ($pirep->state === PirepState::CANCELLED) {
|
||||
throw new BadRequestHttpException('PIREP has been cancelled, comments can\'t be posted');
|
||||
}
|
||||
|
||||
# validation
|
||||
$this->validate($request, ['comment' => 'required']);
|
||||
|
||||
# Add it
|
||||
$comment = new PirepComment($request->post());
|
||||
$comment->pirep_id = $id;
|
||||
$comment->user_id = Auth::user()->id;
|
||||
$comment->save();
|
||||
|
||||
return new PirepCommentResource($comment);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $id
|
||||
* @param Request $request
|
||||
|
35
app/Http/Resources/PirepComment.php
Normal file
35
app/Http/Resources/PirepComment.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\Resource;
|
||||
|
||||
/**
|
||||
* Class Response
|
||||
* @package App\Http\Resources
|
||||
* Generic response resource
|
||||
*/
|
||||
class PirepComment extends Resource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
$user = $this->user;
|
||||
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'comment' => $this->comment,
|
||||
'created_at' => $this->created_at,
|
||||
'user' => [
|
||||
'id' => $user->id,
|
||||
'pilot_id' => $user->pilot_id,
|
||||
'name' => $user->name,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
24
app/Http/Resources/Response.php
Normal file
24
app/Http/Resources/Response.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use Illuminate\Http\Resources\Json\Resource;
|
||||
|
||||
/**
|
||||
* Class Response
|
||||
* @package App\Http\Resources
|
||||
* Generic response resource
|
||||
*/
|
||||
class Response extends Resource
|
||||
{
|
||||
/**
|
||||
* Transform the resource into an array.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return array
|
||||
*/
|
||||
public function toArray($request)
|
||||
{
|
||||
return parent::toArray($request);
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ class User extends Resource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'pilot_id' => $this->pilot_id,
|
||||
'name' => $this->name,
|
||||
'email' => $this->email,
|
||||
'apikey' => $this->apikey,
|
||||
|
@ -26,6 +26,7 @@ Route::group([], function()
|
||||
Route::get('pireps/{id}/route', 'PirepController@route_get');
|
||||
Route::get('pireps/{id}/acars/position', 'PirepController@acars_get');
|
||||
Route::get('pireps/{id}/acars/geojson', 'PirepController@acars_geojson');
|
||||
Route::get('pireps/{id}/comments', 'PirepController@comments_get');
|
||||
|
||||
Route::get('status', 'StatusController@status');
|
||||
Route::get('version', 'StatusController@status');
|
||||
@ -46,6 +47,8 @@ Route::group(['middleware' => ['api.auth']], function ()
|
||||
Route::post('pireps/{id}/acars/log', 'PirepController@acars_log');
|
||||
Route::post('pireps/{id}/acars/logs', 'PirepController@acars_log');
|
||||
|
||||
Route::post('pireps/{id}/comments', 'PirepController@comments_post');
|
||||
|
||||
Route::post('pireps/{id}/route', 'PirepController@route_post');
|
||||
Route::delete('pireps/{id}/route', 'PirepController@route_delete');
|
||||
|
||||
|
136
composer.lock
generated
136
composer.lock
generated
@ -48,7 +48,7 @@
|
||||
"Arrilot\\Widgets\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -488,7 +488,7 @@
|
||||
"Doctrine\\DBAL\\": "lib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -811,7 +811,7 @@
|
||||
"Egulias\\EmailValidator\\": "EmailValidator"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -857,7 +857,7 @@
|
||||
"Parsedown": ""
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -902,7 +902,7 @@
|
||||
"Firebase\\JWT\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -970,7 +970,7 @@
|
||||
"src/Google/Service/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
@ -1007,7 +1007,7 @@
|
||||
"Google_Service_": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
@ -1052,7 +1052,7 @@
|
||||
"Google\\Auth\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache-2.0"
|
||||
],
|
||||
@ -1106,7 +1106,7 @@
|
||||
"GuzzleHttp\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1164,7 +1164,7 @@
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1219,7 +1219,7 @@
|
||||
"src/functions_include.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1281,7 +1281,7 @@
|
||||
"Hashids\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1398,7 +1398,7 @@
|
||||
"Irazasyed\\LaravelGAMP\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1445,7 +1445,7 @@
|
||||
"Jackiedo\\Timezonelist\\": "src/Jackiedo/Timezonelist"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1498,7 +1498,7 @@
|
||||
"stubs/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1544,7 +1544,7 @@
|
||||
"Traitor\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1603,7 +1603,7 @@
|
||||
"src/Laracasts/Flash/functions.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -1732,7 +1732,7 @@
|
||||
"Illuminate\\": "src/Illuminate/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2068,7 +2068,7 @@
|
||||
"League\\ISO3166\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2131,7 +2131,7 @@
|
||||
}
|
||||
],
|
||||
"description": "Bloom filter implementation",
|
||||
"time": "2017-11-30 17:51:14"
|
||||
"time": "2017-11-30T17:51:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
@ -2237,7 +2237,7 @@
|
||||
"Cron\\": "src/Cron/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2286,11 +2286,11 @@
|
||||
"VaCentral\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"time": "2017-12-08 04:00:06"
|
||||
"time": "2017-12-08T04:00:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
@ -2380,7 +2380,7 @@
|
||||
"PhpParser\\": "lib/PhpParser"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -2657,7 +2657,7 @@
|
||||
"phpseclib\\": "phpseclib/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2753,7 +2753,7 @@
|
||||
"PragmaRX\\Version\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2813,7 +2813,7 @@
|
||||
"PragmaRX\\Yaml\\Tests\\": "tests/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2876,7 +2876,7 @@
|
||||
"Prettus\\Repository\\": "src/Prettus/Repository/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -2965,7 +2965,7 @@
|
||||
"Psr\\Cache\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3229,7 +3229,7 @@
|
||||
"Ramsey\\Uuid\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3389,7 +3389,7 @@
|
||||
"Laratrust\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3509,7 +3509,7 @@
|
||||
"Spatie\\Fractalistic\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3575,7 +3575,7 @@
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3758,7 +3758,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3807,7 +3807,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3867,7 +3867,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3923,7 +3923,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -3986,7 +3986,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4035,7 +4035,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4089,7 +4089,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4177,7 +4177,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4226,7 +4226,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4378,7 +4378,7 @@
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4438,7 +4438,7 @@
|
||||
"Resources/stubs"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4493,7 +4493,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4550,7 +4550,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4633,7 +4633,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4717,7 +4717,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4785,7 +4785,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4850,7 +4850,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4912,7 +4912,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -4958,7 +4958,7 @@
|
||||
"TheIconic\\Tracking\\GoogleAnalytics\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5003,7 +5003,7 @@
|
||||
"TijsVerkoyen\\CssToInlineStyles\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -5044,7 +5044,7 @@
|
||||
"Tivie\\OS\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"APACHE 2.0"
|
||||
],
|
||||
@ -5162,7 +5162,7 @@
|
||||
"src/vierbergenlars/SemVer/internal.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5267,7 +5267,7 @@
|
||||
"Webpatser\\Uuid": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5383,7 +5383,7 @@
|
||||
"Zend\\Diactoros\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-2-Clause"
|
||||
],
|
||||
@ -5609,7 +5609,7 @@
|
||||
"Whoops\\": "src/Whoops/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5823,7 +5823,7 @@
|
||||
"src/DeepCopy/deep_copy.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -5936,7 +5936,7 @@
|
||||
"Orchestra\\Testbench\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -6153,7 +6153,7 @@
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -6249,7 +6249,7 @@
|
||||
"Prophecy\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -6367,7 +6367,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -6508,7 +6508,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -6589,7 +6589,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -6779,7 +6779,7 @@
|
||||
"src/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-3-Clause"
|
||||
],
|
||||
@ -7298,7 +7298,7 @@
|
||||
"/Tests/"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
@ -7442,7 +7442,7 @@
|
||||
"src/functions.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "http://packagist.org/downloads/",
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"Apache2"
|
||||
],
|
||||
|
@ -48,8 +48,7 @@ class AcarsTest extends TestCase
|
||||
protected function getPirep($pirep_id)
|
||||
{
|
||||
$this->user = factory(App\Models\User::class)->create();
|
||||
$resp = $this
|
||||
->get('/api/pireps/' . $pirep_id);
|
||||
$resp = $this ->get('/api/pireps/' . $pirep_id);
|
||||
$resp->assertStatus(200);
|
||||
return $resp->json();
|
||||
}
|
||||
@ -163,6 +162,17 @@ class AcarsTest extends TestCase
|
||||
|
||||
$response = $this->post($uri, ['flight_time' => '130']);
|
||||
$response->assertStatus(200); // invalid flight time
|
||||
|
||||
# Add a comment
|
||||
$uri = '/api/pireps/'.$pirep_id.'/comments';
|
||||
$response = $this->post($uri, ['comment' => 'A comment']);
|
||||
$response->assertStatus(201);
|
||||
|
||||
$response = $this->get($uri);
|
||||
$response->assertStatus(200);
|
||||
$comments = $response->json();
|
||||
|
||||
$this->assertCount(1, $comments);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
#use Swagger\Serializer;
|
||||
use App\Services\FareService;
|
||||
use App\Models\User;
|
||||
|
||||
/**
|
||||
@ -166,7 +167,12 @@ class ApiTest extends TestCase
|
||||
*/
|
||||
public function testGetAircraft()
|
||||
{
|
||||
$fare_svc = app(FareService::class);
|
||||
|
||||
$subfleet = factory(App\Models\Subfleet::class)->create();
|
||||
$fare = factory(App\Models\Fare::class)->create();
|
||||
|
||||
$fare_svc->setForSubfleet($subfleet, $fare);
|
||||
$aircraft = factory(App\Models\Aircraft::class)->create([
|
||||
'subfleet_id' => $subfleet->id
|
||||
]);
|
||||
|
Loading…
Reference in New Issue
Block a user