第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

如何在其他控制器中使用CRUD控制器索引(列表)

如何在其他控制器中使用CRUD控制器索引(列表)

PHP
慕哥9229398 2023-08-19 17:27:19
我想制作僅具有關(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”


查看完整回答
反對(duì) 回復(fù) 2023-08-19
  • 1 回答
  • 0 關(guān)注
  • 128 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)