Skip to content

Instantly share code, notes, and snippets.

@uno-de-piera
Created May 18, 2018 11:24
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/33670bd9549ec7848407a2761648a083 to your computer and use it in GitHub Desktop.
Save uno-de-piera/33670bd9549ec7848407a2761648a083 to your computer and use it in GitHub Desktop.
<?php
public function toArray($request)
{
return [
'name' => $this->name,
'email'=> $this->email,
"created_at" => Carbon::createFromFormat('Y-m-d H:i:s', $this->created_at)->format('d-m-Y'),
"invoices" => InvoicesResource::collection($this->whenLoaded('invoices')),
"dni" => $this->dni
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment