Fix PirepComment response; 201 to 200 (#654)

This commit is contained in:
Nabeel S
2020-04-01 01:05:09 -04:00
committed by GitHub
parent e8037c7d69
commit 261984ee90
6 changed files with 44 additions and 15 deletions

View File

@@ -68,7 +68,7 @@ class Pirep extends Resource
$res['arr_airport'] = new Airport($this->arr_airport);
$res['position'] = Acars::make($this->whenLoaded('position'));
$res['comments'] = PirepComment::make($this->whenLoaded('comments'));
$res['comments'] = PirepComment::collection($this->whenLoaded('comments'));
$res['user'] = User::make($this->whenLoaded('user'));
$res['flight'] = Flight::make($this->whenLoaded('flight'));

View File

@@ -4,6 +4,9 @@ namespace App\Http\Resources;
use App\Contracts\Resource;
/**
* @mixin \App\Models\PirepComment
*/
class PirepComment extends Resource
{
/**
@@ -15,6 +18,10 @@ class PirepComment extends Resource
*/
public function toArray($request)
{
if (!$this->user) {
return [];
}
$user = $this->user;
return [