greeniron
greeniron

Reputation: 131

How to display multiple columns which has value in Laravel

I would like to display columns if it has value. Some columns has values some of them don't.

I wrote below code. but it didn't work. Could you teach me how to write code please?

 @php
 if(!empty($image->wc)){
 echo "WC is ";  
 }
 @endphp
{{ $image->wc }} 

@php2
 if(!empty($image->w_type)){
 echo "W Type is :";  
 }
 @endphp2
{{ $image->w_type }} 

Upvotes: 1

Views: 121

Answers (1)

A.A Noman
A.A Noman

Reputation: 5270

You can try this

@if(isset($image->wc))
    echo "WC is".{{$image->wc}};  
@endif

Upvotes: 1

Related Questions