Generating statistical reports
If you just want to do the where for every non-empty value. You can do the following:

public static function allRejUserByProv($prov = '', $gender = '', $dist = '', $ttc = '')
{
    $fields = [
        'gender' =&gt; $gender,
        'p_district' =&gt; $dist,
        'p_province' =&gt; $prov,
        'ttc_name' =&gt; $ttc
    ];

    $result = self::where('decision', '3');

    foreach ($fields as $attr =&gt; $value) {
        if(! empty($value)) {
            $result = $result-&gt;where($attr, $value);
        }
    }

    return $result-&gt;count();
}


This way you will remove the multiple ifs.

If you will always use number_format to format the return value why not just adding it to the function:

return number_format($result-&gt;count());


Hope this helps :)