前台部分接口
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');
|
||||
}
|
||||
}
|
||||
27
app/Models/FileModel.php
Normal file
27
app/Models/FileModel.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
/**
|
||||
* 用户表
|
||||
*/
|
||||
class FileModel extends BaseModel
|
||||
{
|
||||
//
|
||||
protected $table = 'file';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* 角色关联
|
||||
* @return HasOne
|
||||
*/
|
||||
public function user(): HasOne
|
||||
{
|
||||
return $this->hasOne(UserModel::class, 'id', 'user_id');
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
|
||||
/**
|
||||
* 项目技术栈关联表
|
||||
*/
|
||||
class ProjectTechnologyStacksRelationModel extends BaseModel
|
||||
{
|
||||
//
|
||||
protected $table = 'project_technology_stacks_relations';
|
||||
|
||||
protected $guarded = [];
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\BaseApp\BaseModel;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
/**
|
||||
* 技术栈表
|
||||
*/
|
||||
class TechnologyStackModel extends BaseModel
|
||||
{
|
||||
//
|
||||
protected $table = 'technology_stacks';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* 项目关联
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function projects(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(ProjectModel::class, 'project_technology_stack_relations', 'technology_stack_id', 'project_id');
|
||||
}
|
||||
}
|
||||
36
app/Models/UserPayModel.php
Normal file
36
app/Models/UserPayModel.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 UserPayModel extends BaseModel
|
||||
{
|
||||
//
|
||||
protected $table = 'user_pay';
|
||||
|
||||
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