Skip to content

Instantly share code, notes, and snippets.

@mrsimonbennett
Last active August 29, 2015 14:11
Show Gist options
  • Save mrsimonbennett/f6ea0be3b190426cc2eb to your computer and use it in GitHub Desktop.
Save mrsimonbennett/f6ea0be3b190426cc2eb to your computer and use it in GitHub Desktop.
public function present($nest = true)
{
return array_map(
function ($model) use ($nest) {
return $this->createPresenter($model)->present($nest);
},
$this->collection
);
}
Or
public function present($nest = true)
{
$decorated = [];
foreach ($this->collection as $model) {
$decorated[] = $this->createPresenter($model)->present($nest);
}
return $decorated;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment