master
parent
9f6307850f
commit
e0c3aa652b
@ -0,0 +1,21 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Service;
|
||||
|
||||
use App\Model\Promote;
|
||||
|
||||
class PromoteService extends Service
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue