I want to make drop-down list filtering.
I have a web page, that shown some post with title and categories.
The page has a drop-down in nav.blade.php
. I dynamically generate drop-down from categories table. But when I select an item of drop-down (for example a category name) I want page to show me the posts only of that category. Also I have created the Category and Posts model and set the relationships. I can see all posts on my main page but can't filter content with drop-down list.
What I am doing wrong? and how can I solve this issue?
My nav.blade:
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
aria-haspopup="true" aria-expanded="false">Dropdown
<span class="caret"></span></a>
<ul class="dropdown-menu">
<li>@foreach($categories as $category)
<a href="{{URL::route('home',$category->id)}}">
<option value="{{$category->id}}">{{ $category->name }}</option>
</a>
@endforeach
</li>
</ul>
</li>