Tridev Shrestha
Tridev Shrestha

Reputation: 447

How to display image in yajra datatable in laravel

i'm getting only getting path of my image file not image in yajra datatable in laravel..

i already did the steps mentioned on how to show image in yajra datatable column , laravel5.3

but did not help..

my datatable code

editColumn('id_image', function(User $user){
        $url = url("storage/uploads/users/".$user->id. "/".$user->id_image);        
        return '<img src="'. $url .'" />'; 
});

it only returns path of my image, it returns like below

<img src="http://127.0.0.1:8000/storage/uploads/users/38/maruti-suzuki-omni.jpg" />

Upvotes: 0

Views: 3352

Answers (1)

Amrit Shrestha
Amrit Shrestha

Reputation: 1660

you need to update the rawColumns with your column name. suppose your column name is vehicle_image then

// public function dataTable($query)
->rawColumns(['vehicle_image', 'action']);

Upvotes: 2

Related Questions