Laravel bootstrap导航标签

时间:2015-10-25 15:12:22

标签: twitter-bootstrap tabs laravel-5

我在Laravel中有两个关于bootstrap导航标签的问题(我使用材料设计)。当我点击一个标签时,我想让课程处于活动状态,以便它亮起来。在我的菜单中,我这样做:

<li class="{!! Request::is('createticket')  ? 'active' : '' !!}"><a href="/createticket">Maak Ticket</a></li>

但我现在不能这样做,因为它没有提出请求。这是我的代码:

 @extends('standaard.master')
    @section('name', 'Profiel')

    @section('content')
     <div class="container col-md-8 col-md-offset-2">
        <div class="well well bs-component">
            <ul class="nav nav-tabs" style="margin-bottom: 15px;">
                <li class="active"><a href="#gegevens" data-toggle="tab">Gegevens</a></li>
                <li><a href="#onderhoudscontract" data-toggle="tab">Onderhoudscontract</a></li>
                <li><a href="#wachtwoord" data-toggle="tab">Wachtwoord aanpassen</a></li>
            </ul>
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane fade active in" id="gegevens">
                     <form class="form-horizontal" method="post">
                @if(Request::is('profile'))            
                    @foreach ($errors->all() as $error)
                        <p class="alert alert-danger"></p>
                    @endforeach
                @endif    
                    @if (session('status'))
                        <div class="alert alert-success">

                        </div>
                    @endif
                     {!! csrf_field() !!}

                    <fieldset>
                        <legend>Gegevens</legend>
                        <div class="form-group">
                            <label for="name" class="col-lg-2 control-label">Naam</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control" id="name" placeholder="Naam" name="name" value="{!! ucfirst(Auth::User()->name) !!}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="name" class="col-lg-2 control-label">Achternaam</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control" id="lastname" placeholder="Achternaam" name="lastname" value="{!! ucfirst(Auth::User()->lastname) !!}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="email" class="col-lg-2 control-label">Email</label>
                            <div class="col-lg-10">
                                <input type="email" class="form-control" id="disabledInput" placeholder="Email"  disabled="" value="{!! ucfirst(Auth::User()->email) !!}">
                            </div>
                        </div>

                         <div class="form-group">
                            <label for="company" class="col-lg-2 control-label">Bedrijf</label>
                            <div class="col-lg-10">
                                <input type="email" class="form-control" id="disabledInput" placeholder="Email"  disabled="" value="{!! ucfirst(Auth::User()->company) !!}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="company" class="col-lg-2 control-label">Adres</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control" id="adres" placeholder="Adres" name="adres" value="{!! ucfirst(Auth::User()->adres) !!}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="company" class="col-lg-2 control-label">Postcode</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control" id="zip" placeholder="Postcode" name="zip" value="{!! ucfirst(Auth::User()->zip) !!}">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="company" class="col-lg-2 control-label">Woonplaats</label>
                            <div class="col-lg-10">
                                <input type="text" class="form-control" id="city" placeholder="Woonplaats" name="city" value="{!! ucfirst(Auth::User()->city) !!}">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-lg-10 col-lg-offset-2">
                                <button type="reset" class="btn btn-default">Annuleer</button>
                                <button type="submit" class="btn btn-primary">Update profielgegevens </button>
                            </div>
                        </div>
                    </fieldset>
                </form>
                </div>
                <div class="tab-pane fade" id="onderhoudscontract">
                    <legend>Onderhoudscontract(en)</legend>
                @if(Auth::user()->websites->isEmpty())
                <p>U heeft momenteel nog geen onderhoudscontract(en).</p>
                @else
                    @foreach(Auth::user()->websites as $onderhoudscontract)
                    <div id="onderhoudscontractbackground">
                        <strong>Domein: </strong><p>{!! $onderhoudscontract->name !!}</p>
                        <strong>Pakket: </strong><p>{!! $onderhoudscontract->subscription->name !!}</p>
                        <strong>Maandelijkse betaling:</strong><p>{!! $onderhoudscontract->subscriptionstate->name !!}</p>
                    </div>
                    @endforeach
                @endif
                <button class="btn btn-primary">Vragen?</button>
                </div>
                <div class="tab-pane fade" id="wachtwoord">
                   <form class="form-horizontal" method="post" action="/savepassword">
                @if(Request::is('/savepassword'))
                    @foreach ($errors->all() as $error)
                        <p class="alert alert-danger"></p>
                    @endforeach
                @endif
                     @if (session('wachtwoordaangepast'))
                        <div class="alert alert-success">

                        </div>
                    @endif

                     {!! csrf_field() !!}

                    <fieldset>
                        <legend>Wijzig uw wachtwoord</legend>
                        <div class="form-group">
                            <label for="password" class="col-lg-2 control-label">Wachtwoord</label>
                            <div class="col-lg-10">
                                <input type="password" class="form-control" id="password" placeholder="wachtwoord" name="password">
                            </div>
                        </div>

                        <div class="form-group">
                            <label for="password" class="col-lg-2 control-label">Bevestig</label>
                            <div class="col-lg-10">
                                <input type="password" class="form-control" placeholder="Bevestig wachtwoord"name="password_confirmation">
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-lg-10 col-lg-offset-2">
                                <button type="reset" class="btn btn-default">Annuleer</button>
                                <button type="submit" class="btn btn-primary">Verander</button>
                            </div>
                        </div>
                    </fieldset>
                </form>
                </div>
            </div>
        </div>
    </div>
    @endsection

我的第二个问题是,我有两个请求,所以它验证了两种不同的形式。但是当我 提交一个表单,它也会以另一种形式显示$ errors。我尝试用以下方法修复它:

@if(Request::is('profile'))            
    @foreach ($errors->all() as $error)
        <p class="alert alert-danger"></p>
    @endforeach 
@endif

但那不起作用。

0 个答案:

没有答案