【问题标题】:hide actions in lense laravel nova隐藏镜头 laravel nova 中的动作
【发布时间】:2020-06-05 18:40:51
【问题描述】:

如何在镜头页面中隐藏操作我的资源中有以下操作

    public function actions(Request $request)
{
    return [
        (new AddNewURL)
            ->canSee(function () use ($request) { return $request->user()->hasPermission('updatedOrders-create');})
            ->canRun(function () use ($request) { return $request->user()->hasPermission('updatedOrders-create');})
            ->withoutConfirmation(),
        (new EditNewURL)
            ->canSee(function () use ($request) { return $request->user()->hasPermission('updatedOrders-update-all');})
            ->canRun(function () use ($request) { return $request->user()->hasPermission('updatedOrders-update-all');})
            ->withoutConfirmation(),
        (new PrintBillings)
            ->withoutConfirmation()
            ->canSee(function () use ($request) { return $request->user()->hasPermission('orders-actions-print');})
            ->canRun(function () use ($request) { return $request->user()->hasPermission('orders-actions-print');}),
        (new DownloadExcel)
            ->onlyOnIndex()
            ->withoutConfirmation(),
    ];
}

我想将它们隐藏在我已经尝试过的镜头页面中

public function actions(Request $request)
{
    return [];
}

在 lense 类中但没有工作,我也完全删除了 actions 方法但它不起作用。另外,我尝试了->canSee(function () { return false;}),但它不起作用!!!!

【问题讨论】:

    标签: laravel laravel-nova


    【解决方案1】:

    表格行中显示的动作不能被覆盖,但索引右上角显示的动作可以通过覆盖镜头上的action方法来覆盖。

    public function actions(Request $request)
    {
        return [];
    }
    

    在这种情况下,索引中显示的所有操作都将消失

    【讨论】:

      猜你喜欢
      • 2023-03-21
      • 1970-01-01
      • 2020-07-24
      • 2019-03-01
      • 2019-11-01
      • 2019-08-28
      • 2020-06-22
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多