我想按商店过滤。
控制器
function filter(Request $request){
$goods = Good::select('shop_id')->where('shop_id', '=', $request->id)->get();
$shops = Shop::all ();
return view('filter')->with(['goods' => $goods, 'shops' => $shops]);
}

迁移
Schema::create('goods', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('amount');
$table->integer('shop_id');
$table->timestamp('onPurchase');
$table->timestamps();
});
Schema::create('shops', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('adress')->nullable();
$table->timestamps();
});

表单以获取ID
<form action = "{{ route('filter') }}" method="post">
{{ csrf_field() }}
<select name="id">
@foreach ($shops as $shop)
<option value="{{$shop->id}}">{{$shop->name}} {{$shop->adress}}</option>
@endforeach;
</select>
<br><br>
<input type="submit" class="btn btn-primary" value="Pasirinkti">
</form>
&#13;
它不会根据我通过$ _POST获得的所选ID打印列表。任何帮助将不胜感激。