這很難解釋我的問題。我希望你能理解它。如何在laravel中的一個函數中返回同一路徑的多個視圖
對於我的項目我有一個主佈局,其中包含內容的標題和產量。
master.blade.php
@include('partials.header')
<div class="container-fluid main-con">
@yield('content')
@include('partials.footer')
</div>
現在主要的大衆路線我raturning的方法。
Web.php
Route::get('/', [
'uses' => '[email protected]',
'as' => 'product.mainCats'
]);
ProductContoller.php
class ProductContoller extends Controller
{
public function getIndex(){
$ad_cats = Mainaddtype::orderBy('title')->get();
return view('shop.main-categories-page', ['mediacats' => $ad_cats]);
}
}
現在我的查詢, '主要類別頁' 在主內容部分收益。但是我也想在頭文件中使用Mainadtype的相同數據。所以我想在同一個函數上返回標題的視圖。如果你瞭解它,請幫助。
什麼,我想現在是,
public function getIndex(){
$ad_cats = Mainaddtype::orderBy('title')->get();
return view('shop.main-categories-page', ['mediacats' => $ad_cats]);
return view('partials.header', ['mediacats' => $ad_cats]);
}
但我知道,我們不能以這種方式回來。 在此先感謝。
thanxx很多先生!這樣可行!!!!!我非常努力的想要得到這個。非常感謝你:) –
很高興我能幫上忙。 –