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