forked from featherforums/feather
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPresenterServiceProvider.php
More file actions
47 lines (38 loc) · 1.18 KB
/
Copy pathPresenterServiceProvider.php
File metadata and controls
47 lines (38 loc) · 1.18 KB
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
<?php namespace Feather\Presenter;
use Illuminate\View\Environment;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\Engines\CompilerEngine;
class PresenterServiceProvider extends ServiceProvider {
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app['feather.presenter'] = $this->app->share(function($app)
{
return new Presenter($app);
});
$this->registerCompiler();
}
/**
* Register the view compiler.
*
* @return void
*/
public function registerCompiler()
{
// Our compiler needs an instance of the file system and the storage path of the compiled views.
$files = $this->app['files'];
$storagePath = $this->app['path'].'/storage/views';
$this->app['view']->addExtension('blade.php', 'feather.compiler', function() use ($files, $storagePath)
{
// FeatherCompiler is used by Feather is an extension to the Blade compiler. Feather
// has a few special methods that are used throughout views that need to be compiled
// alongside the default Blade methods.
$compiler = new Compilers\FeatherCompiler($files, $storagePath);
return new CompilerEngine($compiler, $files);
});
}
}