1

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 }} 
2
  • I am not clear your @green Commented May 8, 2020 at 9:34
  • Sorry I edit my quesion as simple Commented May 8, 2020 at 9:40

1 Answer 1

1

You can try this

@if(isset($image->wc))
    echo "WC is".{{$image->wc}};  
@endif
Sign up to request clarification or add additional context in comments.

5 Comments

Thank you for answer. I have a quesiton I would like to display $image->wc value too. How to write $image->wc in side of @if ?
If you write inside if condition then use like echo "WC is".{{$image->wc}};
Thank you. I thoguth so but I got syntax error, unexpected 'if' (T_IF)
How is it possible?? Never shows the error just three line.
Sorry for too long time. I figured out the reason my code had couple of blank space that makes error. Thank you very much for helping me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.