Queries to get unpaid and unpaid invoices
There seems to be a section in your code that you repeat three times. This can probably be placed in a separate function. Something like this:
function getInvoiceTotal($status, $onlyOverdue = FALSE)
{
    $query = Capsule::table('tblinvoices');
    $query-&gt;select(Capsule::raw('SUM(total) as total'))
          -&gt;where(['userid' =&gt; $_SESSION['uid'], 
                   'status' =&gt; $status]);
    if ($onlyOverdue &amp;&amp; ($status == 'Unpaid')) {
        $query-&gt;whereDate('duedate', '&lt;=', Carbon::now()-&gt;format('Y-m-d'));
    }    
    return $query-&gt;get()-&gt;total;        
}


add_hook('ClientAreaPageInvoices', 1, function($vars) {
    return ['totalAberto'  =&gt; getInvoiceTotal('Unpaid'), 
            'totalVencido' =&gt; getInvoiceTotal('Unpaid', TRUE), 
            'totalPago'    =&gt; getInvoiceTotal('Paid')];
});

Regretably I don't have Laravel installed so I cannot test this code, but I think the general idea is clear. Perhaps someone with more knowledge of Laravel can add to this answer?
Some notes:

I changed array(....) to [....].
I didn't understand the json_decode(json_encode()) bit. Perhaps to go from objects to arrays? I don't see what's wrong with using the actual objects. Here's where I have most doubt that my code is correct, since I haven't tested it.
I left out a lot of variables you used. Using variables, with good names, can make code easier to read, but in really good code, when a variable is only used once, it shouldn't be necessary.
I strongly advise you to write your code in English only. I had to find out what the meaning of 'Aberto', 'Vencido' and 'Pago' is. Not every programmer speaks Protuguese.