bekaskaki
380
11
Laravel

If condition blade view

Posted 3 months ago by bekaskaki

view :

@foreach($kamar as $room)
@if ($room->status === '2')
<div class="col-sm-3">
<div class="small-box bg-yellow">
<div class="inner">
<h3>{{$room->nomor_kamar}}</h3>
<p>{{$room->typekamar->nama}}</p>
</div>
<div class="icon">
<i class="fa fa-bed"></i>
</div>
<a class="small-box-footer" href="" action="">Bersihkan</a>
</div>
</div>

@else
<div class="alert alert-warning">
<h4>Mohon Maaf</h4>
Untuk sementara, tidak ada kamar yang sedang kotor.
</div>
@endif
@endforeach

controller :

 public function create()
    {
        $title = $this->title;
        $kamar = Kamar::with('typekamar')->where('status',2)->get();
        return view('admin.'.$title.'.create',compact('title','kamar'));
    }

I use if condition, but when I change status '0' in table, else section doesn't appear

Please sign in or create an account to participate in this conversation.