jonnybarnes.uk/app/Providers/HorizonServiceProvider.php

32 lines
791 B
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace App\Providers;
use Illuminate\Http\Request;
use Laravel\Horizon\Horizon;
use Illuminate\Support\ServiceProvider;
class HorizonServiceProvider extends ServiceProvider
{
/**
* Bootstrap the 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');
}
return false;
});
}
}