Projekt

Obecné

Profil

Stáhnout (1.04 KB) Statistiky
| Větev: | Revize:
1
<?php
2

    
3
namespace Illuminate\Database;
4

    
5
use Illuminate\Support\ServiceProvider;
6
use Illuminate\Database\Console\Seeds\SeedCommand;
7

    
8
class SeedServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Indicates if loading of the provider is deferred.
12
     *
13
     * @var bool
14
     */
15
    protected $defer = true;
16

    
17
    /**
18
     * Register the service provider.
19
     *
20
     * @return void
21
     */
22
    public function register()
23
    {
24
        $this->app->singleton('seeder', function () {
25
            return new Seeder;
26
        });
27

    
28
        $this->registerSeedCommand();
29

    
30
        $this->commands('command.seed');
31
    }
32

    
33
    /**
34
     * Register the seed console command.
35
     *
36
     * @return void
37
     */
38
    protected function registerSeedCommand()
39
    {
40
        $this->app->singleton('command.seed', function ($app) {
41
            return new SeedCommand($app['db']);
42
        });
43
    }
44

    
45
    /**
46
     * Get the services provided by the provider.
47
     *
48
     * @return array
49
     */
50
    public function provides()
51
    {
52
        return ['seeder', 'command.seed'];
53
    }
54
}
(15-15/18)