当前正在开发CRM /应用程序的所有者方模块:
这是我面临的要求/困境:
所以我尝试了这个:
//feature/controller
$products = Product::where('store_id', $this->store->id)->get();
return response()
->view('inventory.index', [
'products' => $products,
'store' => $this->store
])
->header('store', $this->store->id);
//view
//stuck here - Not fond of this, because it gives away the ID when doing `GET request`
<form action="{{ route('inventories') }}" method="POST">
@csrf
<input type="hidden" name="store" value="{{ $store->id }}">
</form>
//die dumping (dd) the incoming `$request` shows the hidden input, but prefer to get the header with that key as well
除此之外,这是我要显示的网址:
//Backoffice/Admin:
app.com/stores/1/inventories
app.com/stores/1/orders
//Regular users on their account (but the current store is in Store A for example, and can be Store B the next Tab)
app.com/inventories
app.com/orders
我不确定这种方法是否有效,但是我愿意提出改进建议。
我正在考虑的事情:
更新: