Last active
July 28, 2019 17:51
-
-
Save rakeshsoni18/bb143b31493beb1a49991874f6683259 to your computer and use it in GitHub Desktop.
Multi Level Category in Select Option
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Two Level | |
| @foreach($categories as $category) | |
| <option value="{{$category->id}}">{{$category->name}}</option> | |
| @foreach($category->subcategory as $sub) | |
| <option value="{{$sub->id}}">-{{$sub->name}}</option> | |
| @endforeach | |
| @endforeach | |
| // Three Level | |
| @foreach($categories as $category) | |
| <option value="{{$category->id}}">{{$category->name}}</option> | |
| @foreach($category->subcategory as $sub) | |
| <option value="{{$sub->id}}">-{{$sub->name}}</option> | |
| @foreach($sub->subcategory as $subsub) | |
| <option value="{{$subsub->id}}">--{{$subsub->name}}</option> | |
| @endforeach | |
| @endforeach | |
| @endforeach |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment