Controller
public class ProductsController extends BaseController {
public function getIndex() {
$products = Product::with('category')->get();
return View::make('products', $products);
}
}
View
@foreach ($products as $product)
{{ $product->name }}
{{ $product->category->name}}
@endforeach
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community