LaraCacheServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 11
rs 10
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Mostafaznv\LaraCache;
4
5
use Illuminate\Support\ServiceProvider;
6
use Mostafaznv\LaraCache\Commands\DeleteCacheCommand;
7
use Mostafaznv\LaraCache\Commands\DeleteGroupCacheCommand;
8
use Mostafaznv\LaraCache\Commands\UpdateCacheCommand;
9
use Mostafaznv\LaraCache\Commands\UpdateGroupCacheCommand;
10
11
class LaraCacheServiceProvider extends ServiceProvider
12
{
13
    public function boot(): void
14
    {
15
        if ($this->app->runningInConsole()) {
16
            $this->publishes([__DIR__ . '/../config/config.php' => config_path('laracache.php')], 'config');
17
        }
18
19
        $this->commands([
20
            UpdateCacheCommand::class,
21
            DeleteCacheCommand::class,
22
            UpdateGroupCacheCommand::class,
23
            DeleteGroupCacheCommand::class
24
        ]);
25
    }
26
27
    public function register(): void
28
    {
29
        $this->mergeConfigFrom(__DIR__ . '/../config/config.php', 'laracache');
30
31
        $this->app->bind('laracache', function () {
32
            return new LaraCache;
33
        });
34
    }
35
}
36