Get row counts in grid

I am new to Yii2. I am not able to figure out that how can I get count of rows and display it in grid at backend. For Example: I have to generate a report where a user made how many orders placed and having no. of products, how much total of order amount?

I have relations in my model.




public function getProducts()

    {

        return $this->hasMany(Product::className(), ['user_id' => 'user_id']);

    }

    public function getShopImages(){

        return $this->hasMany(ShopImage::className(), ['user_id' => 'user_id']);

    }

    /**

     * @return \yii\db\ActiveQuery

     */

    public function getOrders()

    {

        // Customer has_many Order via Order.customer_id -> id

        return $this->hasMany(Order::className(), ['user_id' => 'user_id']);

    }

    

    /**

     * @return \yii\db\ActiveQuery

     */

    public function getOrderrs()

    {

        // Customer has_many Order via Order.customer_id -> id

        return $this->hasMany(Order::className(), ['merchant_id' => 'user_id']);

    }



Please do let me know if you guys help me on that or refer a related post.

Thanks