working with laravel 5.6 and mysql. I have following table name as vehicles
id name categoryname brandname model
1 juy car toyota 121
2 gty van nissan caravan
3 bgh car bmw 520d
4 hyu van ford max
5 nhj car toyota 121
i am using following controller function to display categorynames with links
public function showcategoryname()
{
$names = Vehicle::groupBy('categoryname')->select('id', 'categoryname', \DB::raw('COUNT(*) as cnt'))->get();
return view('welcome')->withNames($names);
}
and in blade file,
@foreach($names as $name)
<tr>
<th><a href=""></a></th>
<td><span class="label label-info"></span></td>
</tr>
@endforeach
this is printing my categoryname with link as following car van
now I need when I clicked above categoryname then, displaying its related brand names? as an example when I click car categoryname Then page should displaying its brandnames like toyota bmw how can I do this in controller?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2Qk8DZm
via IFTTT
Aucun commentaire:
Enregistrer un commentaire