Pretty good. The only thing I'd suggest is in your AuthenticateInterface implementation lose the Facade and inject the actual guard instance.
Also the if statement isn't necessary in the auth function.
<?php
namespace Acme\Services;
use Acme\Interfaces\AuthenticateInterface as AuthenticateInterface;
class GuardAuthenticator implements AuthenticateInterface
{
protected $authenticator;
public function __construct(Guard $authenticator)
{
$this->authenticator = $authenticator;
}
public function auth($credentials)
{
$credentials = [
'email' => $credentials['email'],
'password' => $credentials['password']
];
return $this->authenticator->attempt($credentials, true));
}
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community