03.12.2015 Views

laravel4cookbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

File-Based CMS 317<br />

1 public function register()<br />

2 {<br />

3 $this->app->bind(<br />

4 "Formativ\Cms\CompilerInterface",<br />

5 function() {<br />

6 return new Compiler\Blade(<br />

7 $this->app->make("files"),<br />

8 $this->app->make("path.storage") . "/views"<br />

9 );<br />

10 }<br />

11 );<br />

12<br />

13 $this->app->bind(<br />

14 "Formativ\Cms\EngineInterface",<br />

15 "Formativ\Cms\Engine\Blade"<br />

16 );<br />

17<br />

18 $this->app->bind(<br />

19 "Formativ\Cms\FilesystemInterface",<br />

20 function() {<br />

21 return new Filesystem(<br />

22 new Local(<br />

23 $this->app->make("path.base") . "/app/views"<br />

24 )<br />

25 );<br />

26 }<br />

27 );<br />

28 }<br />

This was extracted from workbench/formativ/cms/src/Formativ/Cms/CmsServiceProvider.php.<br />

.<br />

We’re not really adding any extra functionality to that which Flysystem provides. The sole purpose<br />

of us wrapping the Local Flysystem adapter is to make provision for swapping it with another<br />

filesystem class/library.<br />

We should also move the metadata-related functionality into a better location.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!