Rardind Master-Detail Laravel 4.
-
21-12-2019 - |
質問
おはようございます、
私を助けることができる誰か、私は父子息子モデルの間のルートをモデル化するためのルートを作成する必要があり、そのURLは親のIDを主張します。
私のモデルの詳細在庫:
return $this->hasMany('Inventory');
.
マイモデルマスター依存:
return $this->belongsTo('Dependence', 'dependece_id', 'id');
.
私はこのようなものが欲しい:
localhost:8000 /依存関係/ 25 /在庫
あなたの協力をありがとう
解決
Route::get('dependencies/{id}/inventories', function($dependencyId)
{
$dependency = Dependency::findOrFail($dependencyId);
dd($dependency->integory->toArray());
});
. 所属していません StackOverflow