|
|
|
@ -73,10 +73,22 @@ class UserPartnerRepository extends BaseRepository |
|
|
|
|
public function changePartnerForm($uid) |
|
|
|
|
{ |
|
|
|
|
/** @var UserLabelRepository $make */ |
|
|
|
|
$list = $this->dao->getAll($uid)->column('partner_id'); |
|
|
|
|
$partnerForm = new PartnerDao(); |
|
|
|
|
$option = $partnerForm->getAll(); |
|
|
|
|
return compact('list', 'option'); |
|
|
|
|
$list = $this->dao->getAll($uid)->column('partner_id') ?? []; |
|
|
|
|
$data = ['partner_id' => $list, 'uid' => $uid]; |
|
|
|
|
return Elm::createForm(Route::buildUrl('systemUserChangePartner', compact('uid'))->build(), [ |
|
|
|
|
Elm::input('uid', '用户 ID', '')->disabled(true)->required(true), |
|
|
|
|
Elm::selectMultiple('partner_id', '用户合作人角色')->options(function () { |
|
|
|
|
$partnerForm = new PartnerDao(); |
|
|
|
|
$data = $partnerForm->getAll(); |
|
|
|
|
foreach ($data as $value => $label) { |
|
|
|
|
$name = (string)$label['id']; |
|
|
|
|
$value = $label['name']; |
|
|
|
|
$options[] = compact('value', 'name'); |
|
|
|
|
} |
|
|
|
|
return $options; |
|
|
|
|
}), |
|
|
|
|
])->setTitle('编辑合作人角色')->formData($data); |
|
|
|
|
//return compact('list', 'option'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function editPartner(int $uid, array $partner_id = []) |
|
|
|
@ -88,7 +100,7 @@ class UserPartnerRepository extends BaseRepository |
|
|
|
|
if (!empty($partner_id)) { |
|
|
|
|
$data = []; |
|
|
|
|
foreach ($partner_id as $k => $v) { |
|
|
|
|
$data[] = ['uid' => $uid, 'partner_id' => $v,'create_time' => date("Y-m-d H:i:s")]; |
|
|
|
|
$data[] = ['uid' => $uid, 'partner_id' => $v, 'create_time' => date("Y-m-d H:i:s")]; |
|
|
|
|
} |
|
|
|
|
UserPartner::getInstance()->insertAll($data); |
|
|
|
|
} |
|
|
|
|