Reputation: 333
I am working with Laravel 5.2. A portion of my form, I have to choose if a user is active or not. I hard coded a default user to be inactive in users table.
$table->integer('is_active')->default(0);
<div class="form-group">
{!! Form::label('is_active','Status:') !!}
{!! Form::select('is_active',[0=>'inactive',1=>'active'],0,['class'=>'form-control']) !!}
I have played around with it replacing the default value 0 with null like this
<div class="form-group">
{!! Form::label('is_active','Status:') !!}
{!! Form::select('is_active',[0=>'inactive',1=>'active'],null,['class'=>'form-control']) !!}
Still I get the same result.
Heres my table data for front end display.
<td>{{$user->is_active = 0 ? 'Inactive':'Active' }}</td>
Upvotes: 1
Views: 204
Reputation: 151
Just change the condition operation like this. replace "=" by "==".
<td>{{$user->is_active == 0 ? 'Inactive':'Active' }}</td>
Upvotes: 4