Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created May 18, 2018 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uno-de-piera/16e458cb7443dba4cfb6c95f8349316b to your computer and use it in GitHub Desktop.
Save uno-de-piera/16e458cb7443dba4cfb6c95f8349316b to your computer and use it in GitHub Desktop.
<?php
namespace App\Http\Resources;
use Illuminate\Http\Resources\Json\Resource;
class InvoicesResource extends Resource
{
/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request
* @return array
*/
public function toArray($request)
{
return [
"invoice" => $this->id,
'total' => $this->total
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment