Get all users.

User::all(); // Returns UserCollection

Get a user by ID.

User::find($id); // Returns User

Get a user by username.

User::whereUsername($username); // Returns User

Get a user by email.

User::whereEmail($email); // Returns User

Get a user by their OAuth credentials.

User::whereOAuth($provider, $id); // Returns User

Get the currently authenticated user.

User::getCurrent(); // Returns User if logged in

Check whether the user is logged in.

User::loggedIn(); // Returns a boolean

Create a user.

This returns an instance of a UserFactory to allow you to chain and build your user.

User::create(); // Returns UserFactory

Import using:

use Statamic\API\User