i try to change jenis_id (int) to string when they are show up in the table blade. the value in the database and here is my try
@if($ad->jenis_id = '1')
<td>Terkait</td>
@elseif ($ad->jenis_id = '2')
<td>Informasi</td>
@endif
Your problem is a single =
char. You just assign a value to a property instead comparing. You should consider using ==
or ===
. First one checks only value, so coercing takes a place. Triple equality char checks both value AND type.
The operator isn't =
to compare... Use ==
like:
@if($ad->jenis_id == 1)
<td>Terkait</td>
@elseif ($ad->jenis_id == 2)
<td>Informasi</td>
@endif
Hope it helped!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.