Hello guys,
I need to create tabs and I have something like that:
<ul class="nav nav-tabs">
@foreach($services as $serv)
@if($serv->type != null)
<li class="{{ $serv->id == 1 ? 'active' : ''}}"><a data-toggle="tab" href="#{{ $serv->id }}">
@if( $serv->type === 'weddings' )
Tab 1
@elseif ( $serv->type === 'organization')
Tab 2
@elseif ( $serv->type === 'service')
Tab 3
@elseif ( $serv->type === 'production')
Tab 4
@elseif ( $serv->type === 'other')
Tab 5
@endif
</a></li>
@endif
@endforeach
</ul>
<div class="tab-content">
@foreach($services as $serv)
@if($serv->type != null)
<div id="{{ $serv->id }}" class="tab-pane fade in {{ $serv->id == 1 ? 'active' : ''}}">
<h3>{{ $serv->title }}</h3>
<p>{!! $serv->description !!}</p>
</div>
@endif
@endforeach
</div>
It works but not to end correct.
I get a result depending on the number of records in the database on the basis of:
If the record is of the type e.g. "Tab 1" and I have 5 records having the type "Tab 1", I get 5 tabs called "Tab 1".
How to make records of a particular type placed in appropriate tabs instead of creating another??
I need to have 5 tabs: Tab 1, Tab 2, Tab 3, Tab 4, Tab 5
Now I have: Tab 1, Tab 1, Tab 2, Tab 1, Tab 3 - multiple
Thanks for help!