If your view is shop.index you don't have products variable.
If your view is shop.1 you get too many rows if you want only category 1.
I guess it's "category 1" so, I suggest the following :
- more abstraction
- less charge on DB
//Controller
public function category(Request $request)
{
$category = Category::with('products')->find($request->get('category_id'));
return view('shop.1', compact('category'));
}
//view
@extends('layouts.app')
@section('content')
<div class="container">
<h1>Categoriën:</h1>
@foreach ($category->products as $product)
<li>{{ $product->id }} {{ $product->name }}</li>
@endif
@endforeach
</div>
@endsection
It's a first step, you can do better in passing an argument in the route, and use this one instead of $request->get('category_id')