I'm Using Ajax in laravel for create sideBar filter Search,filter products with grades.User Select some checkbox And Send them with this ajax code:

```
 $(document).ready(function (event) {
    $('#Filter_Result').click(function (event) {
        var grades = [];
        $('input[id="grade"]:checked').each(function (index, elem) {
            grades.push($(elem).val());
        });
        $.ajax({
            url: '/Products/Filter',
            type: 'get',
            data:{
                grades : grades,
            },
            dataType : 'html'
        })
            .done(function (response)
        {
            console.log(response);
            $('#Products').html(response);
        });
    });
});

```

And My tables are `productgrades` with `product_id` and `grade_name` columns and `products` table,My Controller here:

```
if ($request->price =="" && is_null($request->subjects))
    {
        for ($i = 1; $i<= sizeof($request->grades); $i++) {
           $product_id= Productgrade::where('grade_name',$request->grades[$i- 
           1])->pluck('product_id');
           for($j=1;$j<=sizeof($product_id);$j++)
           {
              $arr[] = Product::where('id',$product_id[$j-1]);
           }
        }
    }
    $products = collect($arr);
    return view('Products.Main', [
        'products' => $products,  
    ]);

```

And In `Main.blade.php` I'm Trying to get products attribute such this code:

```
@foreach($products as $product)
{{$product->id}}
@endforeach

```

But I Give this Error:

```
Property [id] does not exist on this collection instance.

```

How I Can Solved this problem?