Completed
Push — master ( 74d35d...6602b9 )
by Abdelrahman
02:57 queued 01:44
created

CategoriesServiceProvider::publishResources()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Categories\Providers;
6
7
use Rinvex\Categories\Models\Category;
8
use Illuminate\Support\ServiceProvider;
9
use Rinvex\Support\Traits\ConsoleTools;
10
use Rinvex\Categories\Console\Commands\MigrateCommand;
11
use Rinvex\Categories\Console\Commands\PublishCommand;
12
use Rinvex\Categories\Console\Commands\RollbackCommand;
13
14
class CategoriesServiceProvider extends ServiceProvider
15
{
16
    use ConsoleTools;
17
18
    /**
19
     * The commands to be registered.
20
     *
21
     * @var array
22
     */
23
    protected $commands = [
24
        MigrateCommand::class => 'command.rinvex.categories.migrate',
25
        PublishCommand::class => 'command.rinvex.categories.publish',
26
        RollbackCommand::class => 'command.rinvex.categories.rollback',
27
    ];
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function register()
33
    {
34
        // Merge config
35
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.categories');
36
37
        // Bind eloquent models to IoC container
38
        $this->app->singleton('rinvex.categories.category', $categoryModel = $this->app['config']['rinvex.categories.models.category']);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 136 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
39
        $categoryModel === Category::class || $this->app->alias('rinvex.categories.category', Category::class);
40
41
        // Register console commands
42
        ! $this->app->runningInConsole() || $this->registerCommands();
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function boot()
49
    {
50
        // Publish Resources
51
        ! $this->app->runningInConsole() || $this->publishesConfig('rinvex/laravel-categories');
52
        ! $this->app->runningInConsole() || $this->publishesMigrations('rinvex/laravel-categories');
53
    }
54
}
55