2018-01-24 11:40:34 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
2020-03-23 21:31:35 +08:00
|
|
|
use App\Contracts\Resource;
|
2018-01-24 11:40:34 +08:00
|
|
|
|
|
|
|
class PirepComment extends Resource
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Transform the resource into an array.
|
|
|
|
*
|
2018-08-27 00:40:04 +08:00
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
*
|
2018-01-24 11:40:34 +08:00
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function toArray($request)
|
|
|
|
{
|
|
|
|
$user = $this->user;
|
|
|
|
|
|
|
|
return [
|
2018-03-20 09:50:40 +08:00
|
|
|
'id' => $this->id,
|
|
|
|
'comment' => $this->comment,
|
|
|
|
'created_at' => $this->created_at,
|
|
|
|
'user' => [
|
|
|
|
'id' => $user->id,
|
|
|
|
'pilot_id' => $user->pilot_id,
|
2019-07-17 01:54:14 +08:00
|
|
|
'ident' => $user->ident,
|
2018-03-20 09:50:40 +08:00
|
|
|
'name' => $user->name,
|
2018-01-24 11:40:34 +08:00
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|