Skip to content

Commit 3537c6c

Browse files
committed
Laravel 5 Support
1 parent 4013d18 commit 3537c6c

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

src/Bllim/Datatables/DatatablesServiceProvider.php

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class DatatablesServiceProvider extends ServiceProvider {
1818
*/
1919
public function boot()
2020
{
21-
$this->package('bllim/datatables');
21+
$this->package('bllim/datatables', 'datatables', __DIR__);
2222
}
2323

2424
/**
@@ -44,4 +44,36 @@ public function provides()
4444
return array('datatables');
4545
}
4646

47+
/**
48+
* Register the package's component namespaces.
49+
*
50+
* @param string $package
51+
* @param string $namespace
52+
* @param string $path
53+
* @return void
54+
*/
55+
public function package($package, $namespace = null, $path = null)
56+
{
57+
58+
// Is it possible to register the config?
59+
if (method_exists($this->app['config'], 'package')) {
60+
$this->app['config']->package($package, $path.'/config', $namespace);
61+
} else {
62+
// Load the config for now..
63+
$config = $this->app['files']->getRequire($path .'/config/config.php');
64+
foreach($config as $key => $value){
65+
$this->app['config']->set($namespace.'::'.$key, $value);
66+
}
67+
}
68+
69+
// Register view files
70+
$appView = $this->app['path']."/views/packages/{$package}";
71+
if ($this->app['files']->isDirectory($appView))
72+
{
73+
$this->app['view']->addNamespace($namespace, $appView);
74+
}
75+
76+
$this->app['view']->addNamespace($namespace, $path.'/views');
77+
}
78+
4779
}

0 commit comments

Comments
 (0)