Answer the question
In order to leave comments, you need to log in
Why does the ENUM field in the table produce null even though there is 1?
Hi all! I am writing a small website in Laravel.
Faced such a problem.
The Locale table
has two fields of type ENUM
status for activating the language and favorite for assigning by default
in the admin panel in the table, it normally displays whether the language is active or not
@if ($item->status == 1)
<span class="">{{__('admin.active')}}</span>
@else <span class="">{{__('admin.destroy')}}</span>
@endif
@if($item->favorite == 1)
<i class="far fa-star"></i>
@endif
Answer the question
In order to leave comments, you need to log in
The question is removed, I just did not pass the favorite field in the method
. Added it and everything worked. In short, stupid)))
Because enum with values 'Y' and 'N' have values '1' and '0' in your table.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question