gpt4 book ai didi

backpack-for-laravel - 覆盖 CRUD View

转载 作者:行者123 更新时间:2023-12-04 08:23:22 26 4
gpt4 key购买 nike

我想覆盖 Laravel Backpack CRUD 包的 CRUD View ,因为我想对布局进行小的更改。但显然我不想改变 CRUD 包本身。有没有优雅的方法来做到这一点?

最佳答案

在您的 Controller 中扩展 Backpack\CRUD\app\Http\Controllers\CrudController您需要覆盖要更改的索引、创建、编辑等方法。所有方法都在-

Backpack\CRUD\app\Http\Controllers\CrudController

所有方法都在这里。你需要在这里改变
 public function index()
{
$this->crud->hasAccessOrFail('list');

$this->data['crud'] = $this->crud;
$this->data['title'] = ucfirst($this->crud->entity_name_plural);

// get all entries if AJAX is not enabled
if (! $this->data['crud']->ajaxTable()) {
$this->data['entries'] = $this->data['crud']->getEntries();
}

// load the view from /resources/views/vendor/backpack/crud/ if it exists, otherwise load the one in the package
// $this->crud->getListView() returns 'list' by default, or 'list_ajax' if ajax was enabled
return view('your_view_name', $this->data);
}

关于backpack-for-laravel - 覆盖 CRUD View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39290611/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com