working with laravel 5.6 and mysql. and I have following vehicles
table
id name category brand 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
in controller I am filtering category as following
public function showcategoryname()
{
$names = Vehicle::groupBy('category')->select('id', 'category', \DB::raw('COUNT(*) as cnt'))->get();
return view('welcome')->withNames($names);
}
and printing category in blade file as following,
@foreach($names as $name)
<tr>
<th></th>
</span></td>
</tr>
@endforeach
now I need print brand when I click on categoryname, how can I filter on controller to print brand instead to each category?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2QF9KlD
via IFTTT
Aucun commentaire:
Enregistrer un commentaire