phpvms/app/Http/Resources/News.php
2018-04-11 20:01:41 -05:00

31 lines
595 B
PHP

<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
/**
* Class Response
* @package App\Http\Resources
* Generic response resource
*/
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;
}
}