Advertisement
Guest User

Untitled

a guest
Jul 26th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1.   protected function present($data, $method)
  2.   {
  3.     if ($data instanceof \Illuminate\Database\Eloquent\Model)
  4.       return $data->present()->{$method}();
  5.     elseif ($data instanceof \Illuminate\Database\Eloquent\Collection)
  6.     {
  7.       $arr = [];
  8.       foreach ($data as $d)
  9.         $arr[] = $d->present()->{$method}();
  10.       return $arr;
  11.     }
  12.  
  13.     return $data;
  14.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement