How can I sum all these counts in php laravel query and then display in php?

Viewed 30

this is the code where finding count and taking first records now I need to add all these values. Thanks

    $audio = \App\Models\audiodata::where('u_id', $u_id)->count();
    $credentialdata = \App\Models\credentialdata::where('u_id', $u_id)->count();
    $connection = \App\Models\Connectiondata::where('u_id', $u_id)->first();
    $image = \App\Models\imagedata::where('u_id', $u_id)->first();

for e.g:

$audio + $credentialdata
(int)$audio + (int)$credentialdata

but these two didn't work in my case it says object cannot be converted to int

0 Answers
Related