Skip to content

Dynamically call the handler instance #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 11 additions & 42 deletions src/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,48 +89,6 @@ public function authenticate(array $credentials)
return $response;
}

public function check(array $credentials): bool
{
return $this->authenticate
->factory($this->handler)
->check($credentials);
}

public function loggedIn(): bool
{
return $this->authenticate
->factory($this->handler)
->loggedIn();
}

public function login(User $user)
{
return $this->authenticate
->factory($this->handler)
->login($user);
}

public function loginById(int $userId)
{
return $this->authenticate
->factory($this->handler)
->loginById($userId);
}

public function logout()
{
return $this->authenticate
->factory($this->handler)
->logout();
}

public function forget()
{
return $this->authenticate
->factory($this->handler)
->forget();
}

public function routes(array $config = null)
{
}
Expand Down Expand Up @@ -158,4 +116,15 @@ public function getProvider()

return $this->userProvider;
}

/**
* Dynamically call the handler instance.
*
* @param string $method
* @param array $arguments
*/
public function __call($method, $arguments)
{
return $this->authenticate->factory($this->handler)->{$method}(...$arguments);
}
}