Created
May 26, 2018 13:15
-
-
Save afiqiqmal/77ce56a26b28d7081f5c38b6686e8a4d to your computer and use it in GitHub Desktop.
Horizon Service Provider to distinguish access for valid user only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Providers; | |
use Illuminate\Support\ServiceProvider; | |
use Laravel\Horizon\Horizon; | |
use Zizaco\Entrust\Entrust; | |
class HorizonServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Bootstrap the application services. | |
* | |
* @return void | |
*/ | |
public function boot() | |
{ | |
Horizon::auth(function ($request) { | |
return auth()->user()->can('horizon_access') && auth()->check(); | |
}); | |
} | |
/** | |
* Register the application services. | |
* | |
* @return void | |
*/ | |
public function register() | |
{ | |
// | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment