<?php

namespace app\models\course;

use crmeb\traits\ModelTrait;
use crmeb\basic\BaseModel;

class OrganModel extends BaseModel
{
	/**
     * 数据表主键
     * @var string
     */
    protected $pk = 'id';

    /**
     * 模型名称
     * @var string
     */
    protected $name = 'organ';

    use ModelTrait;

    public static function systemPage($where)
    {
        $model = new self;
        $model = $model->where('is_del', 0);
        $count = $model->count();
        $list = $model->page((int)$where['page'], (int)$where['limit'])->select()->each(function ($item) {
            $item['_add_time'] = date('Y-m-d H:i:s', $item['add_time']);
        })->toArray();
        return compact('count', 'list');
    }

    /**
     * 详情
     */
    public static function getOne($id)
    {
        $info = self::where('is_del', 0)->find($id);
        return $info;
    }

}