Get Newest Horizon (#109)

* Re-publish Horizon assets

* Updated horizon config file

* Newest Horizon now works by using Laravel’s own auth

* For now, remove test for admin login
This commit is contained in:
Jonny Barnes 2019-03-21 19:46:38 +00:00 committed by GitHub
parent e7a44fb663
commit c82c4524eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 995 additions and 80 deletions

View file

@ -2,34 +2,41 @@
namespace App\Providers;
use Illuminate\Http\Request;
use Laravel\Horizon\Horizon;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Gate;
use Laravel\Horizon\HorizonApplicationServiceProvider;
/**
* @codeCoverageIgnore
*/
class HorizonServiceProvider extends ServiceProvider
class HorizonServiceProvider extends HorizonApplicationServiceProvider
{
/**
* Bootstrap the application services.
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
Horizon::auth(function (Request $request) {
// return true/false
if (app()->environment('production') !== true) {
// we arent live so just let us into Horizon
return true;
}
if ($request->session()->has('loggedin')) {
// are we logged in as an authed user
return $request->session()->get('loggedin');
}
parent::boot();
return false;
// Horizon::routeSmsNotificationsTo('15556667777');
// Horizon::routeMailNotificationsTo('example@example.com');
// Horizon::routeSlackNotificationsTo('slack-webhook-url', '#channel');
Horizon::night();
}
/**
* Register the Horizon gate.
*
* This gate determines who can access Horizon in non-local environments.
*
* @return void
*/
protected function gate()
{
Gate::define('viewHorizon', function ($user) {
return in_array($user->name, [
'jonny',
]);
});
}
}