Files
lgp-admin-plus-api/app/Models/AdminModel.php
LQ bcf54c2727 初始化
缺陷:主题配色需要优化整体的同风格
2026-08-14 23:21:21 +08:00

36 lines
816 B
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
namespace App\Models;
use App\BaseApp\BaseModel;
use App\Models\business\DepartmentModel;
use Illuminate\Database\Eloquent\Relations\HasOne;
class AdminModel extends BaseModel
{
protected $table = 'admin';
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $guarded = [];
public function role(): HasOne
{
return $this->hasOne(RoleModel::class, 'id', 'role_id');
}
/**
* 所属部门
*
* 部门表在 business 连接cc_ 前缀Eloquent 关联可以跨连接,
* 但不能和本表做 SQL join需要 join 时只能分两次查再在 PHP 里拼。
*/
public function department(): HasOne
{
return $this->hasOne(DepartmentModel::class, 'id', 'department_id');
}
}