count() == 0){ $unique = true; } } while(!$unique); return $confirmation_code; } public static function hasActivePromotion($user) { $promotion_users = PromotionUser::where('user_id', $user->id)->where('active', 1)->whereNull('user_deleted_at')->get(); foreach($promotion_users as $promotion_user){ if($promotion_user->promotion_admin->isActive()){ return true; } } return false; } }