mercredi 16 mars 2016

how to use multiple if statement in blade file in laravel5

IN laravel5 instead of using foreach i can use the if statement for filter the data on the basis of sql query.how can i view my page using ifelse statement in laravel5. I have three div class in these class how to fetch the data from the database.how to use in the blade.php file.

how can i filter the data from database using routes and controller

        <div class="container">
            <div class="block-content block-content-small-padding">
                <div class="block-content-inner">
                    <h2 class="center">Recent Properties</h2>
                    <ul class="properties-filter">
                        <li class="selected"><a href="#"  class="all" data-filter="*"><span>All</span></a></li>
                         <li><a href="#"  class="featured"    data-filter=".featured" ><span>Featured</span></a></li>
                        <li><a href="#" class="rent" data-filter=".rent" ><span>Rent</span></a></li>
                        <li><a href="#"class="sale" data-filter=".sale" ><span>Sale</span></a></li>
                    </ul>


                        <div class="properties-items isotope"  style="position: relative; overflow: hidden; height: 810px;">
                            <div class="row ">
                @if($val -> $value)     
                 <div class="property-item col-sm-6 col-md-3 isotope-item my " style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                                    <div class="property-box">
                                        <div class="property-box-inner">
                                            <h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
                                            <h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
                                            <div class="property-box-picture">
                                                <div class="property-box-price">{{$value->property_price}}</div>
                                                   <div class="">
                                                    <a href="#" class="property-box-picture-target">
                                                        <img src="images/test/{{$value->image}}" alt="">
                                                    </a>
                                                </div>
                                             </div>
                                        </div>
                                    </div>
                            </div>


            @elseif($val -> $value)

                        <div class="property-item  col-sm-6 col-md-3 isotope-item"  style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                                    <div class="property-box">
                                        <div class="property-box-inner">
                                            <h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
                                            <h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
                                            <div class="property-box-picture">
                                                <div class="property-box-price">{{$value->property_price}}</div>
                                                <div class="">
                                                    <a href="#" class="property-box-picture-target">
                                                        <img src="images/test/{{$value->image}}" alt="">
                                                    </a>
                                                </div>
                                             </div>
                                        </div>
                                    </div>
                                </div>  


                            @else($val -> $value)

                                     <div class="property-item property-sale   col-sm-6 col-md-3 isotope-item myButton my"  style="position: absolute; left: 0px; top: 0px; transform: translate3d(0px, 0px, 0px);">
                                    <div class="property-box">
                                        <div class="property-box-inner">
                                            <h3 class="property-box-title"><a href="#">{{$value->city}}</a></h3>
                                            <h4 class="property-box-subtitle"><a href="#">{{$value->state}}</a></h4>
                                            <div class="property-box-picture">
                                                <div class="property-box-price">{{$value->property_price}}</div>
                                                <div class="">
                                                    <a href="#" class="property-box-picture-target">
                                                        <img src="images/test/{{$value->image}}" alt="">
                                                    </a>
                                                </div>
                                             </div>
                                        </div>
                                    </div>
                                </div> 

                        @endif



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire