Laravel中的页眉页脚控制器 [英] Header Footer Controller in Laravel
本文介绍了Laravel中的页眉页脚控制器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是第一次在Laravel上工作
I am working on Laravel for the first time
我必须在页眉和页脚中创建一个前端菜单动态[类别列表将来自数据库].我必须为此使用哪个控制器. 此框架中可用的任何通用控制器,用于将数据发送到页眉和页脚.
i have to make a Front End Menu Dynamic in Header and Footer [ list of categories will come from database ]. which controller I have to use for this.? any common controller available in this framework to send data to header and footer.
当我在HomeController索引Action中收到数据时,它仅可用于主页.
When I receive the data in HomeController index Action its available for the home page only.
class HomeController {
public function index()
{
$categories = Category::get();
return view('home', compact('categories'));
}
}
谢谢.
推荐答案
查看全文