2016-11-29 00:08:20 -08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
2024-05-29 04:38:15 -07:00
|
|
|
use Illuminate\Support\Facades\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);
|
|
|
|
|
2024-07-04 12:49:22 -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);
|
|
|
|
}
|
|
|
|
}
|