0

我正在使用 laravel-admin 面板,我试图弄清楚如何只显示“订单”表中具有已登录开发人员名称的记录。我阅读了文档,但我没有找到针对这种特定情况的任何解决方案。如果有人可以帮助我,我会很高兴。

这是我的 OrdersController.php:

  protected function grid()
    { 
            if (Admin::user()->isRole('Developer')) {
                $grid = DB::table('order')
                ->where('developer', Admin::user()->username)
                ->get();
            }
     
      
        $grid = new Grid(new Order());

        $grid->column('id', __('Id'));
        $grid->column('customer_name', __('Customer name'));
        $grid->column('email', __('Email'));
        $grid->column('mobile', __('Mobile'));
        $grid->column('project_name', __('Project name'));
        $grid->column('categoria', __('Categoria'));
        $grid->column('contact', __('Contact'));
        $grid->column('domain', __('Domain'));
        $grid->column('new_domain', __('New domain'));
        $grid->column('alojamento', __('Alojamento'));
        $grid->column('criar_email', __('Criar email'));
        $grid->column('facebook', __('Facebook'));
        $grid->column('instagram', __('Instagram'));
        $grid->column('linkedin', __('Linkedin'));
        $grid->column('plan', __('Plan'));
        $grid->column('payment', __('Payment'));
        $grid->column('payment_date', __('Payment date'));
        $grid->column('order_date', __('Order date'));
        $grid->column('state', __('State'));
        $grid->column('developer', __('Developer'));

        return $grid;
    }
4

0 回答 0