I am new to PHP. With Laravel this is simple:
@isset($tags)
@foreach($tags as $tag)
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true">
{{ $tag->name }}
</a>
<ul class="dropdown-menu">
@foreach($tag->categories as $category)
<li><a href="{{-- route('register') --}}" {{$category->name }}</a></li>
<li class="divider"></li>
@endforeach
</ul>
</li>
@endforeach
@endisset
I need to use plain PHP as Laravel seems to slow considerably and I did this
<?php if(isset($tags)): ?>
<?php foreach($tags as $tag): ?>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data toggle="dropdown" role="button" aria-expanded="false" aria-haspopup="true">
<?php echo $tag['name'] ?>
</a>
</li>
<?php endforeach ?>
Now I am stuck.
The $tags display quite alright but I don't seem to get $tag->categories to dropdown.
this how my query looks like:
SELECT t.id, t.name as tag_name, c.id, c.name as c_name from tags t INNER JOIN category_tag ct ON (t.id = ct.tag_id)'.
'INNER JOIN categories c ON (ct.category_id = c.id) ORDER BY t.id
Any help would be nice.
I need to used plain php as laravel seem to slow considerably and I did this..... what? you know laravel is the same as php, just that renders differents tags as well?