jeudi 7 avril 2016

Laravel 5.2 IF Statement Syntax, Change Name based on Value

So, I'm going to moving on from PHP native to Laravel framework. See the code below, it's must be error, but this would tell you what I want. I'm confused to the IF statement in Laravel based my database.

<td>
        {{ 
        @if($book->status==1)
            echo 'Available';
        @elseif($book->status==2)
            echo 'Lost';
        @else
            echo 'Not Available';
        @endif
        }}
</td>

Is that possible to print out the name based on database, example: if the value is 1, then I'll print out 'Lost' on my website? Thank you.

Aucun commentaire:

Enregistrer un commentaire