模型关系设置
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
/**
|
||||
* 技术栈表
|
||||
@@ -13,4 +14,13 @@ class TechnologyStackModal extends Model
|
||||
protected $table = 'technology_stacks';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
/**
|
||||
* 项目关联
|
||||
* @return BelongsToMany
|
||||
*/
|
||||
public function projects(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(ProjectModal::class, 'project_technology_stack_relations', 'technology_stack_id', 'project_id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user