我想制作僅具有關(guān)系的表的列表,例如:桌子:命令過(guò)程在 ProcessCrudController 中,我想將流程列表視圖替換為僅具有關(guān)系(訂單流程)的訂單列表視圖。我嘗試過(guò)的解決方案:在 OrderCrudController 中創(chuàng)建新函數(shù)return view($this->crud->getListView(), $this->data);然后,addClause使用$request->typeURL該解決方案的問(wèn)題:不顯示表中的操作行如果我們嘗試刪除 URL,很容易顯示所有查詢我真的想制作僅與訂單相關(guān)的流程列表視圖,或者有任何建議/想法來(lái)實(shí)現(xiàn)這一點(diǎn)嗎?注意:我正在努力解決這個(gè)問(wèn)題,我沒(méi)有找到解決方案,請(qǐng)幫助我編輯(添加代碼):訂單Crud控制器:protected function setupListOperation(){ // This is the solution that I described before // $request = request(); // $this->crud->addClause('where', 'user_id', '=', $request->type ?? 1); $this->crud->addColumns([ [ 'name' => 'personal_name', 'label' => 'Name', 'type' => 'text', ], [ 'name' => 'notes', 'label' => 'Catatan', 'type' => 'textarea', ], [ 'name' => 'user_id', 'label' => 'Dibuat oleh', 'type' => 'select', 'entity' => 'user', 'attribute' => 'name', 'model' => 'App\User', ], ]);}ProcessCrudController:protected function setupListOperation(){ CRUD::setFromDb(); // This table should be listing Order's query and that only have a process (already created custom_create_view) // That's why i want to take Order's table and not making new custom_list_view}
1 回答

慕絲7291255
TA貢獻(xiàn)1859條經(jīng)驗(yàn) 獲得超6個(gè)贊
您不必創(chuàng)建新視圖,只需使用 addClause ... 修改查詢結(jié)果即可。
在 setupListOperation() 的 ProcessCrudController 中添加您的子句:
$this->crud->addClause('has','order');
假設(shè)流程模型中指向流程的關(guān)系名稱是“order”
- 1 回答
- 0 關(guān)注
- 128 瀏覽
添加回答
舉報(bào)
0/150
提交
取消