登录注册功能

This commit is contained in:
2025-05-05 09:44:50 +08:00
parent db54446f8b
commit 147b2d3fd5
29 changed files with 552 additions and 60 deletions

45
app/Models/UserModel.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
namespace App\Models;
use App\BaseApp\BaseModel;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
/**
* 用户表
*/
class UserModel extends BaseModel
{
//
protected $table = 'users';
protected $guarded = [];
/**
* 项目关联 - 上传视角
* @return HasMany
*/
public function projects(): HasMany
{
return $this->hasMany(ProjectModel::class, 'user_id', 'id');
}
/**
* 项目关联 - 作者视角
* @return HasMany
*/
public function projectsAuthor(): HasMany
{
return $this->hasMany(ProjectModel::class, 'author_id', 'id');
}
/**
* 角色关联
* @return HasOne
*/
public function roles(): HasOne
{
return $this->hasOne(RoleModel::class, 'id', 'role_id');
}
}