Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected function present($data, $method)
- {
- if ($data instanceof \Illuminate\Database\Eloquent\Model)
- return $data->present()->{$method}();
- elseif ($data instanceof \Illuminate\Database\Eloquent\Collection)
- {
- $arr = [];
- foreach ($data as $d)
- $arr[] = $d->present()->{$method}();
- return $arr;
- }
- return $data;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement