catchAdmin/catch/cms/model/Banners.php
2021-05-27 08:55:09 +08:00

54 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
// +----------------------------------------------------------------------
// | Catch-CMS Design On 2020
// +----------------------------------------------------------------------
// | 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\cms\model;
use catchAdmin\cms\model\events\BannersEvent;
class Banners extends BaseModel
{
use BannersEvent;
// 表名
public $name = 'cms_banners';
// 数据库字段映射
public $field = array(
'id',
// banner 标题
'title',
// banner 图片
'banner_img',
// 默认 0 代表首页展示
'category_id',
// 链接地址
'link_to',
// 创建人ID
'creator_id',
// 创建时间
'created_at',
// 更新时间
'updated_at',
// 软删除
'deleted_at',
);
public function getList()
{
return $this->catchSearch()
->field($this->aliasField('*'))
->catchLeftJoin(Category::class, 'id', 'category_id', ['name as category'])
->catchOrder()
->creator()
->paginate();
}
}