我想在laravel背包中覆盖一个动作方法而又不失去其功能。
我正在尝试
use Backpack\CRUD\app\Http\Controllers\Operations\ListOperation\ {index as traitIndex };
use Backpack\CRUD\app\Http\Controllers\CrudController;
class ApplicationCrudController extends CrudController
{
public function setup() {...}
// trying to override using the functionality
public function index() {
parent::traitIndex();
}
}
我想使用$ this-> crud-> setHeading('some string','create');设置标题。进入索引方法。
有什么想法吗?
非常感谢
一分钟前,我尝试了这个并且工作了。
use Backpack\CRUD\app\Http\Controllers\Operations\ListOperation\ // I deleted this {index as traitIndex };
use Backpack\CRUD\app\Http\Controllers\CrudController;
class ApplicationCrudController extends CrudController
{
// Add this
use ListOperation {
index as traitIndex;
}
public function setup() {...}
// trying to override using the functionality
public function index() {
// delete this parent::traitIndex();
// and add this
return $this->traitIndex();
}
}
谢谢。