1
- <?php namespace Webwizo \ Shortcodes ;
1
+ <?php
2
2
3
+ namespace Webwizo \Shortcodes ;
4
+
5
+ use Webwizo \Shortcodes \View \Factory ;
3
6
use Illuminate \Support \ServiceProvider ;
4
7
use Webwizo \Shortcodes \Compilers \ShortcodeCompiler ;
5
- use Webwizo \Shortcodes \View \Factory ;
6
8
7
9
class ShortcodesServiceProvider extends ServiceProvider
8
10
{
@@ -17,13 +19,14 @@ public function boot()
17
19
}
18
20
19
21
/**
20
- * Enable the compiler
22
+ * Enable the compiler.
21
23
*/
22
24
public function enableCompiler ()
23
25
{
24
26
// Check if the compiler is auto enabled
25
27
$ state = $ this ->app ['config ' ]->get ('laravel-shortcodes::enabled ' , false );
26
- // enable when needed
28
+
29
+ // Enable when needed
27
30
if ($ state ) {
28
31
$ this ->app ['shortcode.compiler ' ]->enable ();
29
32
}
@@ -42,7 +45,7 @@ public function register()
42
45
}
43
46
44
47
/**
45
- * Register short code compiler
48
+ * Register short code compiler.
46
49
*/
47
50
public function registerShortcodeCompiler ()
48
51
{
@@ -52,7 +55,7 @@ public function registerShortcodeCompiler()
52
55
}
53
56
54
57
/**
55
- * Register the shortcode
58
+ * Register the shortcode.
56
59
*/
57
60
public function registerShortcode ()
58
61
{
@@ -62,17 +65,19 @@ public function registerShortcode()
62
65
}
63
66
64
67
/**
65
- * Register Laravel view
68
+ * Register Laravel view.
66
69
*/
67
70
public function registerView ()
68
71
{
69
- $ this ->app ->singleton ('view ' , function ($ app ) {
72
+ $ finder = $ this ->app ['view ' ]->getFinder ();
73
+
74
+ $ this ->app ->singleton ('view ' , function ($ app ) use ($ finder ) {
70
75
// Next we need to grab the engine resolver instance that will be used by the
71
76
// environment. The resolver will be used by an environment to get each of
72
77
// the various engine implementations such as plain PHP or Blade engine.
73
78
$ resolver = $ app ['view.engine.resolver ' ];
74
- $ finder = $ app ['view.finder ' ];
75
79
$ env = new Factory ($ resolver , $ finder , $ app ['events ' ], $ app ['shortcode.compiler ' ]);
80
+
76
81
// We will also set the container instance on this view environment since the
77
82
// view composers may be classes registered in the container, which allows
78
83
// for great testable, flexible composers for the application developer.
0 commit comments