This commit is contained in:
JaguarJack
2020-09-03 18:55:25 +08:00
parent e0007d4150
commit 2941eeac1e
6 changed files with 45 additions and 20 deletions

View File

@@ -1,12 +1,15 @@
<?php
namespace catchAdmin\system\model;
use catchAdmin\system\model\search\AttachmentsSearch;
use catcher\base\CatchModel;
use think\file\UploadedFile;
use think\Model;
class Attachments extends CatchModel
{
use AttachmentsSearch;
protected $name = 'attachments';
protected $field = [
@@ -30,21 +33,6 @@ class Attachments extends CatchModel
->paginate();
}
public function searchFileExtAttr($query, $value, $data)
{
return $query->where('file_ext', $value);
}
public function searchMimeTypesAttr($query, $value, $data)
{
return $query->where('mime_type', $value);
}
public function searchDriver($query, $value, $data)
{
return $query->where('driver', $value);
}
/**
*
*

View File

@@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catchAdmin\system\model\search;
trait AttachmentsSearch
{
public function searchFileExtAttr($query, $value, $data)
{
return $query->where('file_ext', $value);
}
public function searchMimeTypesAttr($query, $value, $data)
{
return $query->where('mime_type', $value);
}
public function searchDriver($query, $value, $data)
{
return $query->where('driver', $value);
}
}