mirror of
https://github.com/Bigherollc/wticreatorstudio.git
synced 2026-07-31 05:16:49 -04:00
30 lines
828 B
PHP
30 lines
828 B
PHP
<?php
|
|
|
|
namespace Modules\MLMDownline\Repositories;
|
|
|
|
use App\Models\Staff;
|
|
use App\Models\User;
|
|
use Modules\MLMDownline\Entities\MLMDownlineUser;
|
|
|
|
class UplineRepository
|
|
{
|
|
public function all()
|
|
{
|
|
return Staff::with('user')->whereHas('user', function($query){
|
|
$query->where('id', '>', 1)->whereHas('role', function($q){
|
|
$q->where(function($q) {
|
|
$q->where('type', 'admin')->orWhere('type', 'staff');
|
|
})->whereHas('permissions', function($q) {
|
|
$q->where('route', 'mlm-downline.index');
|
|
});
|
|
});
|
|
})->latest()->get();
|
|
}
|
|
|
|
public function assignUpline($downline, $upline_id)
|
|
{
|
|
$downline->parent_id = $upline_id;
|
|
$downline->update();
|
|
}
|
|
}
|