Undefined variable $pending in Laravel

Solution for Undefined variable $pending in Laravel
is Given Below:

I am getting an undefined variable error when trying to get a count with a where condition.

TransactionsController.php

public function index()
{
    $pending = transactions::where('trans_status','Pending')->showProduct('0');
    
    return view('layouts.content', 
            ['pending' => $pending]);
}

content.blade.php

<h2 class="text-right"><i class="ti-alert f-left"></i><span>{{count($pending)}}</span></h2>

enter image description here