2017-09-08 20:11:38 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2019-03-21 19:46:38 +00:00
|
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
use Laravel\Horizon\HorizonApplicationServiceProvider;
|
2017-09-08 20:11:38 +01:00
|
|
|
|
2023-07-28 11:48:07 +01:00
|
|
|
/**
|
|
|
|
* @psalm-suppress UnusedClass
|
|
|
|
*/
|
2019-03-21 19:46:38 +00:00
|
|
|
class HorizonServiceProvider extends HorizonApplicationServiceProvider
|
2017-09-08 20:11:38 +01:00
|
|
|
{
|
|
|
|
/**
|
2019-03-21 19:46:38 +00:00
|
|
|
* Bootstrap any application services.
|
2017-09-08 20:11:38 +01:00
|
|
|
*/
|
2023-02-18 09:34:57 +00:00
|
|
|
public function boot(): void
|
2017-09-08 20:11:38 +01:00
|
|
|
{
|
2019-03-21 19:46:38 +00:00
|
|
|
parent::boot();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register the Horizon gate.
|
|
|
|
*
|
|
|
|
* This gate determines who can access Horizon in non-local environments.
|
|
|
|
*/
|
2023-02-18 09:34:57 +00:00
|
|
|
protected function gate(): void
|
2019-03-21 19:46:38 +00:00
|
|
|
{
|
|
|
|
Gate::define('viewHorizon', function ($user) {
|
2022-05-14 17:44:14 +01:00
|
|
|
return $user->name === 'jonny';
|
2017-09-08 20:11:38 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|