65 lines
1.4 KiB
PHP
65 lines
1.4 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace app\common\model;
|
||
|
|
|
||
|
|
use support\Model;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* systems 系统/应用表
|
||
|
|
* @property integer $id 系统ID(主键)
|
||
|
|
* @property string $code 系统编码(唯一英文标识)
|
||
|
|
* @property string $name 系统名称
|
||
|
|
* @property string $type 系统类型
|
||
|
|
* @property string $desc 系统描述
|
||
|
|
* @property string $icon 系统图标
|
||
|
|
* @property string $domain_url 系统URL
|
||
|
|
* @property string $is_role 是否区分角色权限
|
||
|
|
* @property integer $sort 排序
|
||
|
|
* @property integer $status 状态
|
||
|
|
* @property integer $created_at 创建时间
|
||
|
|
* @property integer $updated_at 更新时间
|
||
|
|
*/
|
||
|
|
class Systems extends Model
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* The connection name for the model.
|
||
|
|
*
|
||
|
|
* @var string|null
|
||
|
|
*/
|
||
|
|
protected $connection = 'mysql';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The table associated with the model.
|
||
|
|
*
|
||
|
|
* @var string
|
||
|
|
*/
|
||
|
|
protected $table = 'systems';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* The primary key associated with the table.
|
||
|
|
*
|
||
|
|
* @var string
|
||
|
|
*/
|
||
|
|
protected $primaryKey = 'id';
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Indicates if the model should be timestamped.
|
||
|
|
*
|
||
|
|
* @var bool
|
||
|
|
*/
|
||
|
|
public $timestamps = true;
|
||
|
|
|
||
|
|
|
||
|
|
// 系统下的资源
|
||
|
|
public function resources()
|
||
|
|
{
|
||
|
|
return $this->hasMany(Resource::class, 'system_id', 'id');
|
||
|
|
}
|
||
|
|
|
||
|
|
// 拥有该系统访问权限的用户
|
||
|
|
public function users()
|
||
|
|
{
|
||
|
|
return $this->belongsToMany(User::class, 'user_systems', 'system_id', 'user_id');
|
||
|
|
}
|
||
|
|
}
|