登录注册功能
This commit is contained in:
45
app/Models/UserModel.php
Normal file
45
app/Models/UserModel.php
Normal 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');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user