snipe-it/app/Http/Middleware/CheckForDebug.php

28 lines
674 B
PHP
Raw Normal View History

<?php
namespace App\Http\Middleware;
use Illuminate\Support\Facades\Auth;
use Closure;
class CheckForDebug
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return mixed
*/
public function handle($request, Closure $next)
{
2016-11-29 01:44:24 -08:00
view()->share('debug_in_production', false);
if (((Auth::check() && (auth()->user()->isSuperUser()))) && (app()->environment() == 'production') && (config('app.warn_debug') === true) && (config('app.debug') === true)) {
2016-12-29 14:02:18 -08:00
view()->share('debug_in_production', true);
}
return $next($request);
}
}