1: <?php namespace Laravella\Crud;
2:
3: use Illuminate\Support\ServiceProvider;
4: use Laravella\Crud;
5:
6: class CrudServiceProvider extends ServiceProvider {
7:
8: /**
9: * Indicates if loading of the provider is deferred.
10: *
11: * @var bool
12: */
13: protected $defer = false;
14:
15: /**
16: * Bootstrap the application events.
17: *
18: * @return void
19: */
20: public function boot()
21: {
22: $this->package('laravella/crud');
23:
24: include __DIR__ . '/../../routes.php';
25:
26: $this->registerCommands();
27: }
28:
29: /**
30: * Register the service provider.
31: *
32: * @return void
33: */
34: public function register()
35: {
36: // Register 'underlyingclass' instance container to our UnderlyingClass object
37: $this->app['dbgopher'] = $this->app->share(function($app)
38: {
39: return new DbGopher;
40: });
41:
42: // Register 'underlyingclass' instance container to our UnderlyingClass object
43: $this->app['options'] = $this->app->share(function($app)
44: {
45: return new Options;
46: });
47:
48: $this->app->booting(function()
49: {
50: $loader = \Illuminate\Foundation\AliasLoader::getInstance();
51: $loader->alias('DbGopher', 'Laravella\Crud\Facades\DbGopher');
52: $loader->alias('Options', 'Laravella\Crud\Facades\Options');
53: });
54: }
55:
56: /**
57: * Get the services provided by the provider.
58: *
59: * @return array
60: */
61: public function provides()
62: {
63: return array();
64: }
65:
66: /** register the custom commands * */
67: public function registerCommands()
68: {
69:
70: $this->app['command.crud.update'] = $this->app->share(function($app){return new CrudUpdateCommand();});
71: $this->app['command.crud.install'] = $this->app->share(function($app){return new CrudInstallCommand();});
72:
73: $this->commands(
74: 'command.crud.update', 'command.crud.install'
75: );
76: }
77:
78:
79: }