Button in Laravel Datatable not rendering

40

You need to define rawColumns :
public function getProductDatatable()
    {
        $Product = Product::query();
       return Datatables::eloquent($Product)
        ->addColumn('action', function($row) {
            return '<a href="/product/'. $row->id .'/edit" class="btn btn-primary">Edit</a>';
        })

        ->addColumn('add_price', function($row) {
            return '<a href="/product/'. $row->id .'/create-price" class="btn btn-primary">Add Price</a>';
        })
       ->rawColumns(['add_price', 'action'])
       ->make(true);
    }

Comments

Submit
0 Comments