create() : $user; $fingerPrint = FingerPrintDocument::factory()->create(['user_id' => $user->id]); return $fingerPrint->token; } protected function loginAsAdmin($user = ['id' => 1, 'group_id' => 1, 'name' => 'admin', 'email' => 'admin@gmail.com']) { return $this->loginAs(['*'], $user); } protected function loginAsUser($permissions = [], $user = ['id' => 1, 'group_id' => 1, 'name' => 'user', 'email' => 'user@gmail.com']) { return $this->loginAs($permissions, $user); } protected function loginAs($permissions = [], $user = ['id' => 1, 'group_id' => 1, 'name' => 'fake', 'email' => 'fake@gmail.com']) { $user = $user instanceof Model ? $user : new UserDocument($user); $user->permissions = $permissions; $this->be($user); return $this; } }