初始化本地仓库

This commit is contained in:
2026-08-31 11:33:59 +08:00
commit 663f74b633
2390 changed files with 402918 additions and 0 deletions
+186
View File
@@ -0,0 +1,186 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use app\model\message\Message;
use app\model\org\Dept;
use app\model\org\Post;
use core\base\BaseModel;
use core\casbin\model\RuleModel;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* 后台管理员-模型
*/
class Admin extends BaseModel
{
/**
* 启用软删除
*/
use SoftDeletes;
// 完整数据库表名称
protected $table = 'sys_admin';
// 主键
protected $primaryKey = 'id';
protected $appends = ['created_date', 'updated_date'];
protected $casts = [
'backend_setting' => 'array',
'id' => 'string',
];
protected $fillable = [
'id',
'user_name',
'real_name',
'nick_name',
'password',
'is_super',
'mobile_phone',
'email',
'avatar',
'signed',
'dashboard',
'enabled',
'login_ip',
'login_time',
'backend_setting',
'created_by',
'updated_by',
'created_at',
'updated_at',
'deleted_at',
'sex',
'remark',
'birthday',
'tel',
'is_locked',
];
/**
* 判断是否为超级管理员
*
* @return bool
*/
public function isSuperAdmin(): bool
{
return (bool)$this->is_super;
}
/**
* 账号-搜索器
*
* @param $query
* @param $value
*/
public function scopeUserName($query, $value)
{
if (!empty($value)) {
$query->where('user_name', 'like', $value . '%');
}
}
/**
* 用户昵称-搜索器
*
* @param $query
* @param $value
*/
public function scopeRealName($query, $value)
{
if ($value !== '') {
$query->where('real_name', 'like', $value . '%');
}
}
/**
* 用户参数-解析
*
* @param $value
*
* @return mixed
*/
public function getBackendSetting($value): mixed
{
return json_decode($value ?? '', true);
}
/**
* 用户参数-转换
*
* @param $value
*
* @return bool|string
*/
public function setBackendSettingAttr($value): bool|string
{
return json_encode($value, JSON_UNESCAPED_UNICODE);
}
/**
* 关联-主归属信息(1:1)
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function mainInfo(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(AdminMain::class, 'admin_id', 'id');
}
/**
* 关联-用户部门
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function depts(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Dept::class, AdminDept::class, 'admin_id', 'dept_id');
}
/**
* 关联-用户职位
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function posts(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Post::class, AdminPost::class, 'admin_id', 'post_id');
}
/**
* 通过中间表关联角色
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function roles(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Role::class, AdminRole::class, 'admin_id', 'role_id');
}
/**
* 管理消息-列表
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function message(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(Message::class, 'receiver_id', 'id');
}
}
+42
View File
@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 关联模型-策略表
*
* @author Mr.April
* @since 1.0
*/
class AdminCasbin extends Pivot
{
protected $table = 'sys_admin_casbin';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'admin_id',
'admin_casbin_id',
];
}
+39
View File
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 关联模型
*
* @author Mr.April
* @since 1.0
*/
class AdminDept extends Pivot
{
protected $table = 'sys_admin_dept';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'admin_id',
'dept_id',
];
}
+52
View File
@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
*/
namespace app\model\system;
use app\model\org\Dept;
use app\model\org\Post;
use core\base\BaseModel;
class AdminMain extends BaseModel
{
protected $table = 'sys_admin_main';
protected $primaryKey = 'id';
protected $fillable = [
'id',
'admin_id',
'main_dept_id',
'main_post_id',
];
protected $casts = [
'id' => 'string',
'admin_id' => 'string',
'main_dept_id'=> 'string',
'main_post_id' => 'string',
];
public function admin(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Admin::class, 'admin_id', 'id');
}
public function mainDept(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Dept::class, 'main_dept_id', 'id');
}
public function mainPost(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Post::class, 'main_post_id', 'id');
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 关联模型
*
* @author Mr.April
* @since 1.0
*/
class AdminPost extends Pivot
{
protected $table = 'sys_admin_post';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'admin_id',
'post_id',
];
}
+40
View File
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 用户-关联角色模型
*
* @author Mr.April
* @since 1.0
*/
class AdminRole extends Pivot
{
protected $table = 'sys_admin_role';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'admin_id',
'role_id',
];
}
+118
View File
@@ -0,0 +1,118 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use core\base\BaseModel;
/**
* 配置模型
*
* @author Mr.April
* @since 1.0
*/
class Config extends BaseModel
{
/**
* 数据表主键
*
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sys_config';
protected $appends = ['created_date', 'updated_date'];
protected static function booted(): void
{
}
protected $casts = [
];
protected $fillable = [
'id',
'group_code',
'code',
'name',
'content',
'type',
'is_sys',
'enabled',
'created_at',
'created_by',
'updated_at',
'updated_by',
'deleted_at',
'remark',
];
/**
* 分组代码-搜索器
*
* @param $query
* @param $value
*/
public function scopeGroupCode($query, $value): void
{
if (!empty($value)) {
$queryMethod = is_array($value) ? 'whereIn' : 'where';
$query->$queryMethod('group_code', $value);
}
}
/**
* 配置名称-搜索器
*
* @param $query
* @param $value
*/
public function scopeName($query, $value): void
{
if (!empty($value)) {
$queryMethod = is_array($value) ? 'whereIn' : 'where';
$query->$queryMethod('name', $value);
}
}
/**
* 唯一编码-搜索器
*
* @param $query
* @param $value
*/
public function scopeCode($query, $value): void
{
if (!empty($value)) {
$queryMethod = is_array($value) ? 'whereIn' : 'where';
$query->$queryMethod('code', $value);
}
}
/**
* 状态-搜索器
*
* @param $query
* @param $value
*/
public function scopeEnable($query, $value): void
{
if ($value !== '') {
$queryMethod = is_array($value) ? 'whereIn' : 'where';
$query->$queryMethod('enable', $value);
}
}
}
+102
View File
@@ -0,0 +1,102 @@
<?php
declare(strict_types=1);
namespace app\model\system;
use app\model\member\Member;
use core\base\BaseModel;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* 问题反馈
*/
class Feedback extends BaseModel
{
use SoftDeletes;
protected $table = 'sys_feedback';
protected $appends = ['created_date', 'updated_date', 'created_name', 'reply_date', 'reply_name'];
protected $hidden = ['createds', 'replyAdmin'];
protected $fillable = [
'id',
'type',
'content',
'contact',
'images',
'source',
'created_by',
'reply_content',
'reply_by',
'reply_at',
'created_at',
'updated_at',
'deleted_at',
];
protected $casts = [
'images' => 'array',
'created_at' => 'integer',
'updated_at' => 'integer',
'deleted_at' => 'integer',
'created_by' => 'string',
'reply_by' => 'string',
'reply_at' => 'integer',
];
public function getCreatedDateAttribute(): ?string
{
$timestamp = $this->getRawOriginal('created_at');
return empty($timestamp)
? null
: \Carbon\Carbon::createFromTimestamp((int)$timestamp)
->setTimezone(config('app.default_timezone'))
->format('Y-m-d H:i:s');
}
public function createds(): HasOne
{
return $this->hasOne(Member::class, 'id', 'created_by')
->select(['id', 'nickname', 'username']);
}
public function replyAdmin(): HasOne
{
return $this->hasOne(Admin::class, 'id', 'reply_by')
->select(['id', 'real_name', 'user_name', 'nick_name']);
}
public function getReplyDateAttribute(): ?string
{
$timestamp = $this->getRawOriginal('reply_at');
return empty($timestamp)
? null
: \Carbon\Carbon::createFromTimestamp((int)$timestamp)
->setTimezone(config('app.default_timezone'))
->format('Y-m-d H:i:s');
}
public function getReplyNameAttribute(): ?string
{
if (empty($this->getRawOriginal('reply_by'))) {
return null;
}
$admin = $this->relationLoaded('replyAdmin')
? $this->getRelation('replyAdmin')
: $this->replyAdmin()->first();
return (string)($admin?->getRawOriginal('real_name') ?: $admin?->getRawOriginal('nick_name') ?: $admin?->getRawOriginal('user_name') ?: '管理员');
}
public function getCreatedNameAttribute(): string
{
$member = $this->relationLoaded('createds')
? $this->getRelation('createds')
: $this->createds()->first();
return (string)($member?->getRawOriginal('nickname') ?: $member?->getRawOriginal('username') ?: '匿名用户');
}
}
+204
View File
@@ -0,0 +1,204 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use core\base\BaseModel;
/**
* 全局菜单
*
* @property mixed $children
* @author Mr.April
* @since 1.0
*/
class Menu extends BaseModel
{
protected $table = 'sys_menu';
protected $primaryKey = 'id';
protected $appends = ['created_date', 'updated_date'];
protected $fillable = [
'id',
'pid',
'app',
'title',
'code',
'level',
'type',
'sort',
'path',
'component',
'redirect',
'icon',
'is_show',
'is_link',
'link_url',
'open_type',
'is_cache',
'is_sync',
'is_affix',
'variable',
'created_at',
'created_by',
'updated_at',
'updated_by',
'deleted_at',
'methods',
'source',
'platform',
];
/**
* 菜单meta属性
*
* @param $data
*
* @return array
*/
public static function getMetaAttribute($data): array
{
// 1.构建mate数组
$title = trans($data['title'], [], 'menu');
$newData = [
'icon' => $data['icon'] ?? '',
'title' => $title,
'menuVisibleWithForbidden' => true,
'keepAlive' => true,
];
// 2.添加fixed锁定菜单标记
if (isset($data['is_affix']) && ($data['is_affix'] === 1 || $data['is_affix'] === '1')) {
$newData['order'] = -1;
$newData['affixTab'] = true;
}
// 3.是否隐藏菜单
if (isset($data['is_show']) && $data['is_show'] == 0) {
$newData['hideInMenu'] = true;
}
// 4.是否缓存
if (isset($data['is_cache']) && (int)$data['is_cache'] == 1) {
$newData['keepAlive'] = true;
}
//5.是否外链在新窗口打开
if (isset($data['open_type']) && $data['open_type'] == 1) {
$newData['link'] = true;
}
// 更多参数可以在这边添加
return $newData;
}
/**
* Id搜索
*/
public function scopeId($query, $value)
{
if (is_array($value)) {
$query->whereIn('id', $value);
} else {
$query->where('id', $value);
}
}
/**
* Type搜索
*/
public function scopeType($query, $value)
{
if (is_array($value)) {
$query->whereIn('type', $value);
} else {
$query->where('type', $value);
}
}
public function scopeEnabled($query, $value)
{
if (is_array($value)) {
$query->whereIn('enabled', $value);
} else {
$query->where('enabled', $value);
}
}
/**
* 自定义删除-支持模型事件
*
* @return array|bool
*/
public function deleteWithAllChildren(): array|bool
{
$allIds = array_merge([$this->id], $this->getAllChildrenIds());
if (empty($allIds)) {
return false;
}
$successIds = [];
// 分块处理以避免内存问题
collect($allIds)->chunk(100)->each(function ($chunk) use (&$successIds) {
$chunk->each(function ($id) use (&$successIds) {
if ($model = self::find($id)) {
if ($model->delete()) {
// 触发模型事件
$successIds[] = $id;
}
}
});
});
return !empty($successIds) ? $successIds : false;
}
/**
* 获取子级ids
*
* @return array
*/
protected function getAllChildrenIds(): array
{
$childIds = $this->children()->pluck('id')->toArray(); // 获取直接子级的ID
foreach ($this->children as $child) { // 遍历直接子级
$childIds = array_merge($childIds, $child->getAllChildrenIds()); // 递归获取嵌套子级
}
return array_unique($childIds);
}
/**
* 定义子级关系
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function children(): \Illuminate\Database\Eloquent\Relations\HasMany
{
return $this->hasMany(self::class, 'pid');
}
/**
* 通过中间表获取角色
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function roles(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Role::class, RoleMenu::class, 'menu_id', 'role_id');
}
}
+97
View File
@@ -0,0 +1,97 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use core\base\BaseModel;
use core\context\TenantContext;
/**
* 附件模型
*
* @author Mr.April
* @since 1.0
*/
class RecycleBin extends BaseModel
{
/**
* 数据表主键
*
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sys_recycle_bin';
protected $appends = ['created_date', 'updated_date', 'operate_name'];
protected $fillable = [
'id',
'original_id',
'data',
'table_name',
'table_prefix',
'enabled',
'ip',
'operate_by',
'created_at',
'updated_at',
];
protected $casts = [
'data' => 'array',
];
// // 1. 定义访问器/修改器
// public function getDataAttribute($value)
// {
// return json_decode($value, true) ?? [];
// }
//
// public function setDataAttribute($value)
// {
// $this->attributes['data'] = json_encode($value);
// }
/**
* 动态数据库链接(主库)
*
* @return \app\common\model\system\SysRecycleBin
*/
public static function centralConnection(): RecycleBin
{
return (new static)->setConnection(config('database.default'));
}
/**
* 定义访问器
*
* @return null
*/
public function getOperateNameAttribute(): mixed
{
return $this->operate ? $this->operate->operate_name : null;
}
/**
* 关联-操作人
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function operate(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Admin::class, 'id', 'operate_id')->select(['id', 'real_name as operate_name']);
}
}
+120
View File
@@ -0,0 +1,120 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use app\model\org\Dept;
use core\base\BaseModel;
/**
* 角色模型
*
* @author Mr.April
* @since 1.0
*/
class Role extends BaseModel
{
/**
* 数据表主键
*
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sys_role';
protected $appends = ['created_date', 'updated_date'];
protected $fillable = [
'id',
'pid',
'name',
'code',
'role_type',
'data_scope',
'enabled',
'sort',
'remark',
'created_by',
'updated_by',
'created_at',
'updated_at',
'deleted_at',
];
/**
* Id搜索
*/
public function scopeId($query, $value)
{
if (is_array($value)) {
$query->whereIn('id', $value);
} else {
$query->where('id', $value);
}
}
/**
* 角色名称-搜索器
*
* @param $query
* @param $value
*/
public function scopeName($query, $value)
{
if (!empty($value)) {
$query->where('name', 'like', $value . '%');
}
}
/**
* 状态-搜索器
*
* @param $query
* @param $value
*/
public function scopeStatus($query, $value)
{
if ($value !== '') {
$query->where('status', $value);
}
}
/**
* 通过中间表获取菜单
*/
public function menus(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Menu::class, RoleMenu::class, 'role_id', 'menu_id')->orderBy('sort');
}
/**
* 通过中间表获取部门
*/
public function depts(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Dept::class, RoleDept::class, 'role_id', 'dept_id');
}
/**
* 通过中间表获取部门
*/
public function scopes(): \Illuminate\Database\Eloquent\Relations\BelongsToMany
{
return $this->belongsToMany(Dept::class, RoleScopeDept::class, 'role_id', 'dept_id');
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use core\context\TenantContext;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 角色-关联策略表模型
*
* @author Mr.April
* @since 1.0
*/
class RoleCasbin extends Pivot
{
protected $table = 'sys_role_casbin';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'role_id',
'role_casbin_id',
];
}
+40
View File
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 关联模型
*
* @author Mr.April
* @since 1.0
*/
class RoleDept extends Pivot
{
protected $table = 'sys_role_dept';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'role_id',
'dept_id',
];
}
+40
View File
@@ -0,0 +1,40 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 关联模型
*
* @author Mr.April
* @since 1.0
*/
class RoleMenu extends Pivot
{
protected $table = 'sys_role_menu';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'role_id',
'menu_id',
];
}
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* 关联模型
*
* @author Mr.April
* @since 1.0
*/
class RoleScopeDept extends Pivot
{
protected $table = 'sys_role_scope_dept';
/**
* 指示是否自动维护时间戳
*
* @var bool
*/
public $timestamps = false;
protected $fillable = [
'role_id',
'dept_id',
];
}
+80
View File
@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
/**
*+------------------
* madong
*+------------------
* Copyright (c) https://gitee.com/motion-code All rights reserved.
*+------------------
* Author: Mr. April (405784684@qq.com)
*+------------------
* Official Website: http://www.madong.cn
*/
namespace app\model\system;
use core\base\BaseModel;
/**
* 附件模型
*
* @author Mr.April
* @since 1.0
*/
class Upload extends BaseModel
{
/**
* 数据表主键
*
* @var string
*/
protected $primaryKey = 'id';
protected $table = 'sys_upload';
protected $appends = ['created_date', 'updated_date'];
protected $fillable = [
'id',
'url',
'size',
'size_info',
'hash',
'filename',
'original_filename',
'base_path',
'path',
'ext',
'content_type',
'platform',
'th_url',
'th_filename',
'th_size',
'th_size_info',
'th_content_type',
'object_id',
'object_type',
'attr',
'created_at',
'created_by',
'updated_at',
'updated_by',
];
/**
* createds
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function createds(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Admin::class, 'id', 'created_by')->select('id', 'real_name as created_name');
}
public function updateds(): \Illuminate\Database\Eloquent\Relations\HasOne
{
return $this->hasOne(Admin::class, 'id', 'updated_by')->select('id', 'real_name as updated_name');
}
}