Completed
Push — master ( e713f9...a10cf9 )
by Abdelrahman
02:41 queued 01:33
created

ContactsServiceProvider::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\Contacts\Providers;
6
7
use Rinvex\Contacts\Models\Contact;
8
use Illuminate\Support\ServiceProvider;
9
use Rinvex\Support\Traits\ConsoleTools;
10
use Rinvex\Contacts\Console\Commands\MigrateCommand;
11
use Rinvex\Contacts\Console\Commands\PublishCommand;
12
use Rinvex\Contacts\Console\Commands\RollbackCommand;
13
14
class ContactsServiceProvider 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.contacts.migrate',
25
        PublishCommand::class => 'command.rinvex.contacts.publish',
26
        RollbackCommand::class => 'command.rinvex.contacts.rollback',
27
    ];
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function register()
33
    {
34
        // Merge config
35
        $this->mergeConfigFrom(realpath(__DIR__.'/../../config/config.php'), 'rinvex.contacts');
36
37
        // Bind eloquent models to IoC container
38
        $this->app->singleton('rinvex.contacts.contact', $contactModel = $this->app['config']['rinvex.contacts.models.contact']);
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 129 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
        $contactModel === Contact::class || $this->app->alias('rinvex.contacts.contact', Contact::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-contacts');
52
        ! $this->app->runningInConsole() || $this->publishesMigrations('rinvex/laravel-contacts');
53
    }
54
}
55