i use laravel:command for function, which is i need to know how many reviews been given to my products, i will capture my database example below:

[Product fields](https://i.stack.imgur.com/tUtdo.png)

[Reviews fields](https://i.stack.imgur.com/GmCzI.png)

i've already declare the relationship which is:

App\Models\Product :

```
public function rev()
    {
        return $this->hasMany(Reviews::class, 'product_id', 'id');
    }

```

App\Models\Review :

```
public function prod()
    {
        return $this->belongsTo(Products::class, 'product_id','id');
    }

```

and this is my command for the function:

```
protected $signature = 'review:product {product_id}';
public function handle()
{
    $id = $this->arguments('product_id');
    $products = Products::with('rev')->whereId($id)->get();

    foreach ($products as $key => $value) {
        $rating = $value->rev->rating;
    }

    dd($products);
}

```

after i run my command it returns this error
[Error](https://i.stack.imgur.com/DUTGB.png)

what i'm expecting is i could get the whole rating of specific id