You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
payment/app/Repository/PromoteRepository.php

21 lines
539 B
PHP

<?php
declare(strict_types=1);
namespace App\Repository;
use App\Model\Promote;
class PromoteRepository
{
public function getLevelPromotesById($id, $columns = ['*']) {
$promote = Promote::query()->where('id', $id)->first(Promote::$levelColumns);
$levelIds = [];
foreach (Promote::$levelColumns as $column) {
if ($promote->{$column} > 0) {
$levelIds[] = $promote->{$column};
}
}
return Promote::query()->whereIn('id', $levelIds)->get($columns);
}
}