QueuefyServiceProvider::boot()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Rakshitbharat\Queuefy;
4
5
use Illuminate\Console\Scheduling\Schedule;
6
use Illuminate\Support\ServiceProvider;
7
8
class QueuefyServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Bootstrap the application services.
12
     */
13
    public function boot()
14
    {
15
        if ($this->app->runningInConsole()) {
16
            $this->commands([
17
                ConsoleCommand::class
18
            ]);
19
            $this->app->booted(function () {
20
                $schedule = app(Schedule::class);
21
                $schedule->command('queuefy:run')->everyMinute();
22
            });
23
        }
24
    }
25
26
    /**
27
     * Register the application services.
28
     */
29
    public function register()
30
    {
31
        // Automatically apply the package configuration
32
        $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'queuefy');
33
34
        // Register the main class to use with the facade
35
        $this->app->singleton('queuefy', function () {
36
            return new Queuefy;
37
        });
38
    }
39
}
40