I created a helper function for count all notification in navbar, For this I am storing clause in a single variable.
I am accessing it by calling-
countData("notification","WHERE seen_status = '0'")
My function is-
function countData($table,$clause) {
$result = DB::select("SELECT * FROM $table $clause");
return count($result);
}
It working fine, but getting error in-
countData("projects","GROUP BY user")
I can use groupBy('user') but problem is, I don't want to pass too many variable inside my function. So, is there any option to run my custom query by using single variable?