-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathViewServiceProvider.php
65 lines (55 loc) · 1.72 KB
/
ViewServiceProvider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace Mods\View;
use Mods\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
class ViewServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
$directives = require __DIR__.'/directives.php';
collect($directives)->each(function ($item, $key) {
Blade::directive($key, $item);
});
}
/**
* Register bindings in the container.
*
* @return void
*/
public function register()
{
$this->registerLayoutBinder();
}
public function registerLayoutBinder()
{
$this->app->bind(\Layout\Core\Contracts\Cacheable::class, function ($app) {
return $app['layout.cache'];
});
$this->app->bind(\Layout\Core\Contracts\EventsDispatcher::class, function ($app) {
return $app['layout.event'];
});
$this->app->bind(\Layout\Core\Contracts\ConfigResolver::class, function ($app) {
return $app['layout.config'];
});
$this->app->bind(\Layout\Core\Contracts\Profiler::class, function ($app) {
return $app['layout.profile'];
});
$this->app->singleton('layout.cache', function ($app) {
return new Layout\Cache($app['cache']);
});
$this->app->singleton('layout.event', function ($app) {
return new Layout\Event($app['events']);
});
$this->app->singleton('layout.config', function ($app) {
return new Layout\Config($app['config']);
});
$this->app->singleton('layout.profile', function ($app) {
return new Layout\Profiler();
});
}
}