Support the ongoing development of Laravel.io →
Architecture
Last updated 1 year ago.
0

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));
    }           
}
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.