Answer the question
In order to leave comments, you need to log in
How to display two models in one url?
there is 1 layout (welcome.blade.php) and sidebar and main in it, created two models with migrations: Sidebar and Main and, accordingly, two route tables
:
got content for main:Route::get('/', '[email protected]');
public function main(Request $request) {
$mains = Main::all();
return view('index_hub', ['mains'=>$mains]);
Answer the question
In order to leave comments, you need to log in
public function main(Request $request) {
$mains = Main::all();
$sidebar = Sidebar::all();
return view('index_hub', ['mains' => $mains, 'sidebar' => $sidebar]);
}
<sidebar>
// тут мб таблица, или просто вывод какой-то определённой инфы.
// тогда просто делаем запрос к модели и выводим
// пример для div таблицы
@foreach(Sidevar::all() as $sidevar)
<div>{{ $sidebar->name }}</div>
@endforeach
</sidebar>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question