HorizonServiceProvider::gate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Providers;
4
5
use Illuminate\Support\Facades\Gate;
6
use Laravel\Horizon\Horizon;
7
use Laravel\Horizon\HorizonApplicationServiceProvider;
8
9
class HorizonServiceProvider extends HorizonApplicationServiceProvider
10
{
11
    public function boot()
12
    {
13
        parent::boot();
14
15
        // Horizon::routeSmsNotificationsTo('15556667777');
16
        // Horizon::routeMailNotificationsTo('[email protected]');
17
        // Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
18
19
        Horizon::night();
20
    }
21
22
    protected function gate()
23
    {
24
        Gate::define('viewHorizon', fn ($user) => optional($user)->isAdmin());
25
    }
26
}
27