Completed
Pull Request — master (#34)
by Fèvre
05:12 queued 02:29
created

AppServiceProvider   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 44
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B boot() 0 26 1
A register() 0 4 1
1
<?php
2
namespace Xetaravel\Providers;
3
4
use Illuminate\Support\Facades\Blade;
5
use Illuminate\Support\Facades\View;
6
use Illuminate\Support\ServiceProvider;
7
use Illuminate\Pagination\Paginator;
8
9
class AppServiceProvider extends ServiceProvider
10
{
11
    /**
12
     * Bootstrap any application services.
13
     *
14
     * @return void
15
     */
16
    public function boot()
17
    {
18
        // View
19
        View::addNamespace('Admin', base_path() . '/resources/views/Admin');
20
        View::addNamespace('Blog', base_path() . '/resources/views/Blog');
21
        View::addNamespace('Auth', base_path() . '/resources/views/Auth');
22
        View::addNamespace('Discuss', base_path() . '/resources/views/Discuss');
23
24
        // Pagination
25
        Paginator::defaultView('vendor.pagination.bootstrap-4');
26
27
        // Blade
28
        Blade::directive('auth', function () {
29
            return "<?php if (Auth::check()): ?>";
30
        });
31
        Blade::directive('endauth', function () {
32
            return "<?php endif; ?>";
33
        });
34
35
        Blade::directive('notauth', function () {
36
            return "<?php if (!Auth::check()): ?>";
37
        });
38
        Blade::directive('endnotauth', function () {
39
            return "<?php endif; ?>";
40
        });
41
    }
42
43
    /**
44
     * Register any application services.
45
     *
46
     * @return void
47
     */
48
    public function register()
49
    {
50
        //
51
    }
52
}
53