Completed
Push — master ( a5bfea...791204 )
by Sebastian
04:24
created

BladeDirectiveServiceProvider::boot()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
namespace App\Providers;
4
5
use Blade;
6
use Illuminate\Support\ServiceProvider;
7
8
class BladeDirectiveServiceProvider extends ServiceProvider
9
{
10
    public function register()
11
    {
12
    }
13
14
    public function boot()
15
    {
16
        Blade::directive('json', function($expression) {
17
            return "<?php echo json_encode({$expression}); ?>";
18
        });
19
    }
20
}
21