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

AppServiceProvider::boot()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 8.8571
c 0
b 0
f 0
cc 1
eloc 14
nc 1
nop 0
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