Skip to content

Instantly share code, notes, and snippets.

@adridev
Created September 15, 2016 13:45
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 adridev/fae972b07a815227a280d5cabe884ebc to your computer and use it in GitHub Desktop.
Save adridev/fae972b07a815227a280d5cabe884ebc to your computer and use it in GitHub Desktop.
<?php
//...
/**
* @return mixed
*/
protected function buildUserView(\App\Models\User\User $user)
{
$userView = new class($user->getAttribute('id'), $user->getAttribute('email'), $user->getAttribute('name'))
{
public $name;
public $id;
public $email;
public function __construct($name, $id, $email)
{
$this->name = $name;
$this->id = $id;
$this->email = $email;
}
};
return $userView;
}
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment