/** * @return mixed */ private function getCompletedProfiles($limit = null) { $profiles = Profile::completed()->get()->filter(function ($profile) { return $profile->hasProfilePic(); }); return !is_null($limit) && $profiles->count() > $limit ? $profiles->random($limit) : $profiles; }