configPickupGroup = $configPickupGroup; } //列表 public function index($request) { $perPage = isset($request['per_page']) ? $request['per_page'] : env('PER_PAGE'); $where = []; if(isset($request['id'])){ $where[] = ['id', '=', $request['id']]; } return $this->configPickupGroup->where($where)->orderBy('id', 'asc')->paginate($perPage); } /** * 添加自提点分组 */ public function create($request) { if($this->configPickupGroup->where('name', trim($request['name']))->exists()){ throw new HttpException(500, '该自提点已经存在'); } $data = [ 'name' => $request['name'], ]; if (!$this->configPickupGroup->create($data)) { throw new HttpException(500, '添加失败'); } } }