vendredi 30 septembre 2016

Show in view only object with specified id

i am woking on a project about a restaurant and i need to show on my staff view only the Chef and Su-Chef which has id (Chef-2, Su-Chef 4). I need to show on my view all the Chefs and all the Su-Chefs. The view is organised at the form that is the number is odd (i have the image on left and text on right), if the number is even i have (i have the image on right and text on left) Here is my Controller

public function index()
{
    $staff = Staff::where('visible','yes')->where('delete','no')->orderBy('name','DESC')->get();
    return view('staff.staff', ['staff' => $staff]);
}

And this is my View

<section class="bg-deep-yellow">
    <div class="container">
        <div class="row">
            <!-- section title -->
            <div class="col-md-12 text-center">
                <span class="title-small black-text text-uppercase letter-spacing-3 font-weight-600">I NOSTRI CHEF</span>
                <div class="separator-line-thick bg-black no-margin-bottom margin-one xs-margin-top-five"></div>
            </div>
            <!-- end section title -->
        </div>
        <div class="row margin-ten no-margin-bottom">

            <!-- chef  -->
            <div class="col-md-12 sm-margin-bottom-ten">
                <div class="col-md-5 chef-img cover-background" style="background-image:url();">
                    <div class="img-border"></div>
                </div>
                <div class="col-md-7 chef-text bg-white text-center">

                    <img src="" alt=""/><br>
                    <span class="text-large black-text text-uppercase letter-spacing-3 font-weight-600 margin-ten display-block no-margin-bottom">Patrick Smith</span>
                    <span class="text-small text-uppercase letter-spacing-3">Chef, Co-Founder</span>
                    <p class="text-med margin-ten width-90 center-col" style="text-align: justify">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
                </div>
            </div>
            <!-- end chef  -->
            <!-- chef  -->
            <div class="col-md-12">
                <div class="col-md-7 chef-text bg-white text-center">

                    <img src="" alt=""/><br>
                    <span class="text-large black-text text-uppercase letter-spacing-3 font-weight-600 margin-ten display-block no-margin-bottom">Sancho Pansa</span>
                    <span class="text-small text-uppercase letter-spacing-3">Bartender</span>
                    <p class="text-med margin-ten width-90 center-col" style="text-align: justify" >Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>

                </div>
                <div class="col-md-5 chef-img cover-background" style="background-image:url();">
                    <div class="img-border"></div>
                </div>
            </div>
            <!-- end chef  -->
        </div>
    </div>
</section>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire