StripeWebhooksServiceProvider::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 Spatie\StripeWebhooks;
4
5
use Illuminate\Support\Facades\Route;
6
use Illuminate\Support\ServiceProvider;
7
8
class StripeWebhooksServiceProvider extends ServiceProvider
9
{
10
    public function boot()
11
    {
12
        if ($this->app->runningInConsole()) {
13
            $this->publishes([
14
                __DIR__.'/../config/stripe-webhooks.php' => config_path('stripe-webhooks.php'),
15
            ], 'config');
16
        }
17
18
        Route::macro('stripeWebhooks', function ($url) {
19
            return Route::post($url, '\Spatie\StripeWebhooks\StripeWebhooksController');
20
        });
21
    }
22
23
    public function register()
24
    {
25
        $this->mergeConfigFrom(__DIR__.'/../config/stripe-webhooks.php', 'stripe-webhooks');
26
    }
27
}
28