I wanted my boolean to result in "true" or "false" instead of 1 and 0. So i tried using if and else statements to get results that I want to reflect in my User Interface. However, I still encountered some errors and I don't know where I made a mistake.
This is my code in the View folder
@extends('layouts.default')
@section('body')
<div class="well">
<table class="table">
<thead>
<th>Student ID</th>
<th>lastname</th>
<th>firstname</th>
<th>middlename</th>
<th>hscard</th>
<th>tor</th>
<th>dismissal</th>
<th>goodmoral</th>
<th>birth certificate</th>
<th>form 137</th>
<th>grade evaluation</th>
</thead>
@foreach ($results as $result)
<tr>
<td>{{$result->studentid}}</td>
<td>{{$result->lastname}}</td>
<td>{{$result->firstname}}</td>
<td>{{$result->middlename}}</td>
<td>{{$result->hscard}}</td>
<td>{{$result->tor}}</td>
<td>{{$result->dismissal }}</td>
<td>{{$result->goodmoral}}</td>
<td>{{$result->bcrtfcate}}</td>
<td>{{$result->form137}}</td>
<td>{{$result->grade_evaluation}}
</td>
</tr>
@endforeach
</table>
</div>
@stop
I tried adding this at if and else statement, and I still encountered some errors:
<td>{{$result->grade_evaluation}}
@if($result==1)
true
@else
false
</td>
This is probably a Laravel issue, it is a PHP issue.
If the $result variable has a value, it will return the value. If it doesn't, it will return 0.
If you want to test if the $result variable has a value or not, you better use the isset() function and try something like
@if(isset($result))
true
@else
false
@endif
The code above should work as you expect.