私はLaravelの初心者で、現在、Laravel 5.2を使用して、基本的に多くの情報を含むダッシュボードであるイントラネットアプリをコーディングしています。要件の1つは、さまざまなストアをナビゲートできることです。アプリの各ページには、ストアのコードが必要です。
現在、すべてのテーブルに列 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 を使用してストア情報を取得し、この変数をすべてのコントローラーとビューで利用できるようにしたいと考えています。次の URL を使用できる場所
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 について読んだことがありますが、それらすべてについて本当に混乱しました。