uploadType = $value; return $this; } /** * 设置上传配置 * @param $value * @return $this */ public function setUploadConfig($value) { $this->uploadConfig = $value; return $this; } /** * 设置上传配置 * @param $value * @return $this */ public function setFile($value) { $this->file = $value; return $this; } /** * 设置保存文件数据表 * @param $value * @return $this */ public function setTableName($value) { $this->tableName = $value; return $this; } /** * 保存文件 */ public function save() { $this->completeFilePath = Filesystem::disk('public')->putFile('upload', $this->file, 'md5'); $this->completeFileUrl = request()->domain() . '/' . str_replace(DIRECTORY_SEPARATOR, '/', $this->completeFilePath); } /** * 删除保存在本地的文件 * @return bool|string */ public function rmLocalSave() { try { $rm = unlink($this->completeFilePath); } catch (\Exception $e) { return $e->getMessage(); } return $rm; } }