Need help on this simple code, what code should I replace at 
`$users = User::all();` so I can conditional chaining the scope method and paginate it at the end?

I tried initiate the `User` object with `$users = new User();` and there is error, Trying to get property of non-object error when using at `VIEW`. 

```
public function index()
{
    // user search

    $name = $this->request->name;
    $email = $this->request->email;

    $users = User::all();

    if (!empty($name)) {
        $users->name($name);
    }

    if (!empty($email)) {
        $users->email($email);
    }

    $users->paginate(5);

    return view('admin.users.index',compact('users'));
}

```

Thanks in advance