Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Session;
4
 
5
use Illuminate\Contracts\Cache\Factory as CacheFactory;
6
use Illuminate\Session\Middleware\StartSession;
7
use Illuminate\Support\ServiceProvider;
8
 
9
class SessionServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Register the service provider.
13
     *
14
     * @return void
15
     */
16
    public function register()
17
    {
18
        $this->registerSessionManager();
19
 
20
        $this->registerSessionDriver();
21
 
22
        $this->app->singleton(StartSession::class, function ($app) {
23
            return new StartSession($app->make(SessionManager::class), function () use ($app) {
24
                return $app->make(CacheFactory::class);
25
            });
26
        });
27
    }
28
 
29
    /**
30
     * Register the session manager instance.
31
     *
32
     * @return void
33
     */
34
    protected function registerSessionManager()
35
    {
36
        $this->app->singleton('session', function ($app) {
37
            return new SessionManager($app);
38
        });
39
    }
40
 
41
    /**
42
     * Register the session driver instance.
43
     *
44
     * @return void
45
     */
46
    protected function registerSessionDriver()
47
    {
48
        $this->app->singleton('session.store', function ($app) {
49
            // First, we will create the session manager which is responsible for the
50
            // creation of the various session drivers when they are needed by the
51
            // application instance, and will resolve them on a lazy load basis.
52
            return $app->make('session')->driver();
53
        });
54
    }
55
}