【发布时间】:2016-07-13 22:47:09
【问题描述】:
我是 Laravel 的新手,目前正在编写一个 Intranet 应用程序,它基本上是一个包含大量信息的仪表板,使用 Laravel 5.2,其中一个要求是能够浏览不同的商店。应用程序的每个页面,都需要商店的代码。
目前我的所有表中都有一个列 store_id,我使用带有路由的 GET 来检索这个值,例如:
www.mysite.com/1/employees -> will list all employees from Store 1
www.mysite.com/1/employees/create -> will create employee to Store 1
www.mysite.com/2/financial -> will list all financial widgets with data from Store 2
我想从 GET 中删除我的 STORE_ID,并对我的 topbar.blade.php 中的所有商店使用 DROPDOWN 选择,例如:
<select>
<option selected>Store1</option>
<option>Store2</option>
</select>
每当有人选择“Store1”或“Store2”时,我都想使用 StoreController 获取 Store 信息,并使此变量可用于所有控制器和视图。我可以在哪里使用以下网址
www.mysite.com/employees -> will list all employees from "Depending of the SELECT"
www.mysite.com/employees/create -> will create employee to "Depending of the SELECT"
www.mysite.com/financial -> will list all financial widgets with data from "Depending of the SELECT"
我已经阅读了 View Composer、Facades、ServiceProvide,但我对它们都感到非常困惑。
【问题讨论】:
标签: controller views laravel-5.2 intranet laravel-facade