要在 filament v3 中創(chuàng)建或更新資源后重定向到列表頁面,您可以在資源類中使用自定義特征。
創(chuàng)建自定義特征
<?php namespace app\traits; trait redirectindex { protected function getredirecturl(): string { return $this->getresource()::geturl('index'); } }
關(guān)注:愛掏網(wǎng)
在您的燈絲資源中使用該特性
class CreateProduct extends CreateRecord { protected static string $resource = ProductResource::class; //add trait in your CreateRecord or UpdateRecord use \App\Traits\RedirectIndex; }
關(guān)注:愛掏網(wǎng)
以上就是Filament 如何使用 Trait(創(chuàng)建、更新)后重定向到列表頁面的詳細(xì)內(nèi)容,更多請關(guān)注愛掏網(wǎng) - it200.com其它相關(guān)文章!
聲明:所有內(nèi)容來自互聯(lián)網(wǎng)搜索結(jié)果,不保證100%準(zhǔn)確性,僅供參考。如若本站內(nèi)容侵犯了原著者的合法權(quán)益,可聯(lián)系我們進行處理。