catchAdmin/catch/cms/model/Banners.php

54 lines
1.6 KiB
PHP
Raw Normal View History

2021-05-22 11:02:45 +08:00
<?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;
2021-05-26 20:35:19 +08:00
use catchAdmin\cms\model\events\BannersEvent;
2021-05-22 11:02:45 +08:00
class Banners extends BaseModel
{
2021-05-26 20:35:19 +08:00
use BannersEvent;
2021-05-22 11:02:45 +08:00
// 表名
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',
);
2021-05-26 20:35:19 +08:00
public function getList()
{
return $this->catchSearch()
->field($this->aliasField('*'))
->catchJoin(Category::class, 'id', 'category_id', ['name as category'])
->catchOrder()
->creator()
->paginate();
}
2021-05-22 11:02:45 +08:00
}