diff --git a/src/Controllers/CypressController.php b/src/Controllers/CypressController.php index 960cf9e..1b4e328 100644 --- a/src/Controllers/CypressController.php +++ b/src/Controllers/CypressController.php @@ -28,15 +28,19 @@ public function login(Request $request) { $attributes = $request->input('attributes', []); - $user = app($this->userClassName()) - ->newQuery() - ->where($attributes) - ->first(); - - if (!$user) { - $user = $this->factoryBuilder($this->userClassName())->create( - $attributes - ); + if (empty($attributes)) { + $user = $this->factoryBuilder($this->userClassName())->create(); + } else { + $user = app($this->userClassName()) + ->newQuery() + ->where($attributes) + ->first(); + + if (!$user) { + $user = $this->factoryBuilder($this->userClassName())->create( + $attributes + ); + } } return tap($user, function ($user) {