$params['custom_id'], 'name' => $params['name'], 'position' => $params['position'], 'phone' => $params['phone'], 'telephone' => $params['telephone'], 'email' => $params['email'], 'notes' => $params['notes'], 'annex' => $params['annex'], 'status' => $params['status'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑 * @param array $params * @return bool * @author likeadmin * @date 2023/11/11 22:56 */ public static function edit(array $params): bool { Db::startTrans(); try { CustomContacts::where('id', $params['id'])->update([ 'custom_id' => $params['custom_id'], 'name' => $params['name'], 'position' => $params['position'], 'phone' => $params['phone'], 'telephone' => $params['telephone'], 'email' => $params['email'], 'notes' => $params['notes'], 'annex' => $params['annex'], 'status' => $params['status'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除 * @param array $params * @return bool * @author likeadmin * @date 2023/11/11 22:56 */ public static function delete(array $params): bool { return CustomContacts::destroy($params['id']); } /** * @notes 获取详情 * @param $params * @return array * @author likeadmin * @date 2023/11/11 22:56 */ public static function detail($params): array { return CustomContacts::with(['customName'])->findOrEmpty($params['id'])->toArray(); } }