如何从laravel nova中的资源列表中删除所有复选框?

问题描述 投票:1回答:1

我有一个laravel nova应用。与资源列表上的其他nova应用程序一样,它在每行之前显示一个复选框。以及全选的选项。

“这是这些复选框的屏幕截图”

我想从资源列表中删除那些复选框。

谢谢。

laravel laravel-nova
1个回答
0
投票

1。空动作

如果资源没有任何操作,则在资源文件中重写availableActions方法:

/** * Get the actions that are available for the given request. * * @param \Laravel\Nova\Http\Requests\NovaRequest $request * @return \Illuminate\Support\Collection */ public function availableActions(NovaRequest $request) { return []; }

2。用CSS隐藏。

将其放入自定义工具中,或覆盖layout.blade.php

.table td:first-child, .table th:first-child,.v-popover.-mx-2 { display: none; }

3。自定义resource-index组件。

创建自定义工具并覆盖/nova/resources/js/views/Index.vue。这是显示逻辑的复选框所在的地方。

/** * Determine whether to show the selection checkboxes for resources */ shouldShowCheckBoxes() { return ( Boolean(this.hasResources && !this.viaHasOne) && Boolean( this.actionsAreAvailable || this.authorizedToDeleteAnyResources || this.canShowDeleteMenu ) ) },
© www.soinside.com 2019 - 2024. All rights reserved.