phpvms/app/Http/Resources/News.php
2018-08-26 16:40:04 +00:00

30 lines
519 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
/**
* Class Response
*/
class News extends Resource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
*
* @return array
*/
public function toArray($request)
{
$resp = parent::toArray($request);
$resp['user'] = [
'id' => $this->user->id,
'name' => $this->user->name,
];
return $resp;
}
}