<?php
namespace App\Admin\Actions\Users;
use App\Models\UserFollow;
use Dcat\Admin\Grid;
use Dcat\Admin\Grid\LazyRenderable;

class FansList extends LazyRenderable
{
    public function grid(): Grid
    {
        $grid = new Grid(new UserFollow());
        $grid->model()->with('user:id,name,avatar')->where('target_id',$this->payload['id'])->orderByDesc('id');

        $grid->column('user.name',trans('user.fields.name'));
        $grid->column('user.avatar',trans('user.fields.avatar'))->image('',50);
        $grid->column('created_at');
        $grid->quickSearch(['user.name']);
        $grid->paginate(10);

        $grid->disableRowSelector();
        $grid->disableActions();
//        $grid->actions(function (Grid\Displayers\Actions $actionss) {
//            $actionss->disableView();
//            $actionss->disableEdit();
//        });

        return $grid;
    }
}
