yajra/laravel-datatables laravel 7 display image code example

Example: YajraBox image not showing

return DataTables::of($artists)->addColumn('image', function ($artist) { 
            $url= asset('storage/'.$artist->image);
            return '<img src="'.$url.'" border="0" width="40" class="img-rounded" align="center" />';
        })->addColumn('action', function ($artist) {
                return '<a href="/admin/artist/'.$artist->id.'/edit" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-edit"></i> Edit</a>
                   <a href="admin/artist/"'.$artist->id .'" class="btn btn-xs btn-danger"><i class="glyphicon glyphicon-trash"></i> Delete</a>   ';
        })->rawColumns(['image', 'action'])->make(true);

Tags:

Misc Example