要在 filament v3 中創(chuàng)建或更新資源后重定向到列表頁(yè)面,您可以在資源類中使用自定義特征。
創(chuàng)建自定義特征
<?php namespace app\traits;
trait redirectindex
{
protected function getredirecturl(): string
{
return $this->getresource()::geturl('index');
}
}
登錄后復(fù)制
在您的燈絲資源中使用該特性
class CreateProduct extends CreateRecord
{
protected static string $resource = ProductResource::class;
//add trait in your CreateRecord or UpdateRecord
use \App\Traits\RedirectIndex;
}
登錄后復(fù)制






