Skip to content

Instantly share code, notes, and snippets.

@deleugpn
Created September 26, 2017 18:50
Show Gist options
  • Select an option

  • Save deleugpn/77869236c548a12943abb8aa539ffb89 to your computer and use it in GitHub Desktop.

Select an option

Save deleugpn/77869236c548a12943abb8aa539ffb89 to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
class UsersResource extends Resource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
'id' => $this->id,
'name' => $this->name,
'email' => $this->email
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment