Created
August 26, 2017 17:30
-
-
Save deleugpn/c7406236e0a87cd06c5b7d3a509fda2d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Http\Resources; | |
use Illuminate\Http\Resources\Json\Resource; | |
class PostsResource extends Resource | |
{ | |
/** | |
* Transform the resource into an array. | |
* | |
* @param \Illuminate\Http\Request | |
* @return array | |
*/ | |
public function toArray($request) | |
{ | |
return [ | |
'title' => $this->title, | |
'body' => $this->body | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment