BladeDirectives   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 15
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A register() 0 8 3
1
<?php
2
3
namespace Thinkstudeo\Rakshak\Support;
4
5
use Illuminate\Support\Facades\Blade;
6
7
class BladeDirectives
8
{
9
    /**
10
     * Register the blade directives.
11
     *
12
     * @return void
13
     */
14
    public static function register()
15
    {
16
        Blade::if('role', function ($role) {
17
            return auth()->check() && auth()->user()->hasRole($role);
18
        });
19
20
        Blade::if('anyrole', function ($roles) {
21
            return auth()->check() && auth()->user()->hasAnyRole(explode('|', $roles));
22
        });
23
    }
24
}
25