更新附件模型
This commit is contained in:
parent
fe6ea82014
commit
c06e7b8694
@ -2,6 +2,8 @@
|
||||
namespace catchAdmin\system\model;
|
||||
|
||||
use catcher\base\CatchModel;
|
||||
use think\file\UploadedFile;
|
||||
use think\Model;
|
||||
|
||||
class Attachments extends CatchModel
|
||||
{
|
||||
@ -42,4 +44,25 @@ class Attachments extends CatchModel
|
||||
{
|
||||
return $query->where('driver', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @time 2020年06月01日
|
||||
* @param $data ['driver' => '', 'path' => '', 'url' => ],
|
||||
* @param UploadedFile $file
|
||||
* @return Attachments|Model
|
||||
*/
|
||||
public static function store($data, UploadedFile $file)
|
||||
{
|
||||
return parent::create([
|
||||
'file_size' => $file->getSize(),
|
||||
'mime_type' => $file->getMime(),
|
||||
'file_ext' => $file->getOriginalExtension(),
|
||||
'filename' => $file->getOriginalName(),
|
||||
'driver' => $data['driver'],
|
||||
'url' => $data['url'],
|
||||
'path' => $data['path']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user