模型关联数据修正
This commit is contained in:
@@ -41,7 +41,7 @@ class ProjectModal extends Model
|
|||||||
*/
|
*/
|
||||||
public function labels(): BelongsToMany
|
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
|
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,5 +3,12 @@
|
|||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
|
|
||||||
|
$framework = \App\Models\ProjectModal::with([
|
||||||
|
'frameworks',
|
||||||
|
'labels',
|
||||||
|
'technologyStacks',
|
||||||
|
])->get();
|
||||||
|
ds($framework);
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user