模型关联数据修正
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled

This commit is contained in:
2025-04-28 17:00:09 +08:00
parent 44c1e18745
commit ba260c2bf4
2 changed files with 9 additions and 2 deletions

View File

@@ -41,7 +41,7 @@ class ProjectModal extends Model
*/
public function labels(): BelongsToMany
{
return $this->belongsToMany(LabelModal::class, 'project_labels_relations', 'project_id', 'label_id');
return $this->belongsToMany(LabelModal::class, 'project_label_relations', 'project_id', 'label_id');
}
/**
@@ -68,7 +68,7 @@ class ProjectModal extends Model
*/
public function technologyStacks(): BelongsToMany
{
return $this->belongsToMany(TechnologyStackModal::class, 'project_technology_stacks_relations', 'project_id', 'technology_stack_id');
return $this->belongsToMany(TechnologyStackModal::class, 'project_technology_stacks_relations', 'project_id', 'technology_stacks_id');
}
/**

View File

@@ -3,5 +3,12 @@
use Illuminate\Support\Facades\Route;
Route::get('/', function () {
$framework = \App\Models\ProjectModal::with([
'frameworks',
'labels',
'technologyStacks',
])->get();
ds($framework);
return view('welcome');
});