前台部分接口
This commit is contained in:
36
app/Models/CollectionModel.php
Normal file
36
app/Models/CollectionModel.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
/**
|
||||
* 用户收藏表
|
||||
*/
|
||||
class CollectionModel extends BaseModel
|
||||
{
|
||||
//
|
||||
protected $table = 'collection';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* 用户关联
|
||||
* @return HasOne
|
||||
*/
|
||||
public function user(): HasOne
|
||||
{
|
||||
return $this->hasOne(UserModel::class, 'id', 'user_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 项目关联
|
||||
* @return HasOne
|
||||
*/
|
||||
public function project(): HasOne
|
||||
{
|
||||
return $this->hasOne(ProjectModel::class, 'id', 'project_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user