2
 public function queryCountUsers($query) {
        $query->where(['confirmed' => true])->count();
    }

I want to query all the users who are already confirmed and those all users who have role_id of 2 or 3 but How can i do it ?

1 Answer 1

1

You could add ->where('role_id',2)->orWhere('role_id',3) to your function, but it's probably a better idea to use Laravel's whereIn function:

$query->where(['confirmed' => true])->whereIn('role_id', [2,3])->count();

This is supported in every version of Laravel.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.