2025-04-28 16:15:09 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2025-04-28 16:45:23 +08:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2025-04-28 16:15:09 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 标签表
|
|
|
|
|
*/
|
|
|
|
|
class LabelModal extends Model
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
protected $table = 'labels';
|
|
|
|
|
|
|
|
|
|
protected $guarded = [];
|
2025-04-28 16:45:23 +08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 项目关联
|
|
|
|
|
* @return BelongsToMany
|
|
|
|
|
*/
|
|
|
|
|
public function projects(): BelongsToMany
|
|
|
|
|
{
|
|
|
|
|
return $this->belongsToMany(ProjectModal::class, 'project_labels_relations', 'label_id', 'project_id');
|
|
|
|
|
}
|
2025-04-28 16:15:09 +08:00
|
|
|
}
|