When debug
is set to true
in Laravel's app/config.php
is there any way to restrict the resultant Whoops
error page with stack trace to certain IP addresses, and IPs not on that list being shown a specific view?
Thanks.
When debug
is set to true
in Laravel's app/config.php
is there any way to restrict the resultant Whoops
error page with stack trace to certain IP addresses, and IPs not on that list being shown a specific view?
Thanks.
Not built in no.
But you could probably implement this quite easily by capturing all exceptions and only re-throwing once you've compared the IP address of the user.
So in app/start/global.php
you'd need to configure the "Application Error Handler". At the moment it captures all exceptions and simply logs them with Log::error
. So in there you could compare the users IP address with an array of valid IP addresses:
App::error(function(Exception $exception, $code)
{
Log::error($exception);
$validIpAddresses = ['123.456.789.0', '321.654.987.0'];
if (in_array(Request::getClientIp(), $validIpAddresses))
{
throw $exception;
}
return View::make('error');
});