route('bike'))->id; $rules = [ 'bike_no' => 'required|unique:bikes,bike_no,' . $id, 'box_no' => 'sometimes|unique:bikes,box_no,' . $id, 'battery_power' => '', 'is_link' => '', 'is_lock' => '', 'is_low_battery_power' => '', 'is_riding' => '', 'is_trouble' => '', 'last_use_bike_end_time' => '', 'last_location' => '', 'last_location_time' => '', 'put_area_id' => '', 'put_status' => 'required', 'put_time' => '', ]; if ($this->isMethod('put')) { $rules = Arr::only($rules, $this->keys()); } return $rules; } public function attributes() { return [ 'bike_no' => '车辆编号', 'box_no' => '控制设备编号', 'battery_power' => '电量', 'is_link' => '是否在线', 'is_lock' => '是否锁车', 'is_low_battery_power' => '是否电量低', 'is_riding' => '是否骑行', 'is_trouble' => '是否故障', 'last_use_bike_end_time' => '最后骑行时间', 'last_location' => '最后位置信息', 'last_location_time' => '最后定位时间', 'put_area_id' => '投放区域id', 'put_status' => '投放状态', 'put_time' => '投放时间', ]; } }