51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Illuminate\Session;
|
|
|
|
use Illuminate\Support\ServiceProvider;
|
|
use Illuminate\Session\Middleware\StartSession;
|
|
|
|
class SessionServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Register the service provider.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
$this->registerSessionManager();
|
|
|
|
$this->registerSessionDriver();
|
|
|
|
$this->app->singleton(StartSession::class);
|
|
}
|
|
|
|
/**
|
|
* Register the session manager instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function registerSessionManager()
|
|
{
|
|
$this->app->singleton('session', function ($app) {
|
|
return new SessionManager($app);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Register the session driver instance.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected function registerSessionDriver()
|
|
{
|
|
$this->app->singleton('session.store', function ($app) {
|
|
// First, we will create the session manager which is responsible for the
|
|
// creation of the various session drivers when they are needed by the
|
|
// application instance, and will resolve them on a lazy load basis.
|
|
return $app->make('session')->driver();
|
|
});
|
|
}
|
|
}
|