<?php

namespace AuthStack\AuthProfie\Provider;

use Illuminate\Support\ServiceProvider;

use AuthStack\AuthProfile\Services\ProfileManager;

class ProfileManagerProvider extends ServiceProvider
{
    public function register()
    {
        $this->app->singleton('ProfileManager', function($app)
        {
            if(function_exists('session'))
            {
                return ProfileManager::fromArray(session('profiles', []), session('active', []));
            }

            return ProfileManager::fromArray([], []);
        });
    }
}