public function users($type, $id) { $usersIDs = Like::usersIDs($this->str($type), $id); if ($usersIDs->count() == 0) { return $this->respond([]); } $users = User::whereIn('id', $usersIDs->toArray())->with('cars')->get(); if (!$users) { return $this->respond([]); } $response = $users->map(function ($user) { $rsp = $this->collectionTransformer->transformUserToSmall($user); $rsp['cars'] = $this->collectionTransformer->transformCars($user->cars); return $rsp; }); return $this->respond($response); }