Good evening, I'm trying to get the categories and their respective articles. I would like the name of the category to appear in the view as a title and then each of your articles appear:
For example:
COMPUTATION: keyboard, mouse, laptop
VEHICLES: truck, car
... and thus of each category
I have the following driver but I'm not sure it's like this:
$articulos=DB::table('articulo as art')
->join('categoria as cat','art.idcategoria','cat.idcategoria')
->select('cat.nombre as categoria','art.nombre as articulo')
->get();
return view('almacen.articulo.index',["articulos"=>$articulos]);
And the view would be:
@foreach($articulos as $art)
{{$art->categoria}}
//Aqui otro @foreach???
@endforeach
If someone could help me ... thanks in advance.