2016-11-29 00:08:20 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Auth;
|
2019-03-13 20:12:03 -07:00
|
|
|
use Closure;
|
2016-11-29 00:08:20 -08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2021-06-10 13:15:52 -07:00
|
|
|
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);
|
2016-11-29 00:08:20 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
return $next($request);
|
|
|
|
}
|
|
|
|
}
|