PHP code example of peterfox / hexavel

1. Go to this page and download the library: Download peterfox/hexavel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

peterfox / hexavel example snippets


namespace App\Bridge\Eloquent;

use App\Bridge\Eloquent\Model\User;
use App\Domain\AuthenticatableRepository as AuthenticatableRepositoryInterface;
use Hexavel\Repository\EloquentRepository;
use Illuminate\Contracts\Auth\Authenticatable;

class AuthenticatableRepository extends EloquentRepository implements AuthenticatableRepositoryInterface
{
    public function getModel()
    {
        return User::class;
    }

    /**
     * @param string $email
     * @return Authenticatable
     */
    public function findByAuthIdentifier($email)
    {
        return $this->model->where('email', $email)->first();
    }
}

namespace App\Laravel\Providers;

use App\Bridge\Eloquent\Model\User;
use App\Bridge\Eloquent\AuthenticatableRepository;
use App\Domain\AuthenticatableRepository as AuthenticatableRepositoryInterface;
use Hexavel\Support\Providers\RepositoryProvider as ServiceProvider;

class RepositoryServiceProvider extends ServiceProvider
{

    /**
     * @return string[]
     */
    protected function getModelRepositories()
    {
        return [
            AuthenticatableRepository::class => User::class
        ];
    }

    /**
     * @return string[]
     */
    protected function getRepositories()
    {
        return [
            AuthenticatableRepositoryInterface::class => AuthenticatableRepository::class
        ];
    }
}