|
|
@ -2,11 +2,11 @@ |
|
|
|
|
|
|
|
|
namespace App\Exceptions; |
|
|
namespace App\Exceptions; |
|
|
|
|
|
|
|
|
|
|
|
use Log; |
|
|
use Exception; |
|
|
use Exception; |
|
|
use Illuminate\Auth\Access\AuthorizationException; |
|
|
|
|
|
use Illuminate\Auth\AuthenticationException; |
|
|
use Illuminate\Auth\AuthenticationException; |
|
|
|
|
|
use Illuminate\Auth\Access\AuthorizationException; |
|
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; |
|
|
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; |
|
|
use Log; |
|
|
|
|
|
|
|
|
|
|
|
class Handler extends ExceptionHandler |
|
|
class Handler extends ExceptionHandler |
|
|
{ |
|
|
{ |
|
|
@ -46,18 +46,6 @@ class Handler extends ExceptionHandler |
|
|
*/ |
|
|
*/ |
|
|
public function render($request, Exception $exception) |
|
|
public function render($request, Exception $exception) |
|
|
{ |
|
|
{ |
|
|
/**modified part**/ |
|
|
|
|
|
if ($request->wantsJson()) { |
|
|
|
|
|
return response([ |
|
|
|
|
|
'success' => false, |
|
|
|
|
|
'message' => $e->getMessage() |
|
|
|
|
|
], 403); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ($exception instanceof AuthorizationException) { |
|
|
|
|
|
\Log::warning("Unauthorized Access or Action \nURL: " . $request->fullUrl() . " \nIP: " . $request->ip() . "\nForm: " . json_encode($request->all()) . "\n"); |
|
|
|
|
|
return response($exception->getMessage(), 403); |
|
|
|
|
|
} |
|
|
|
|
|
return parent::render($request, $exception); |
|
|
return parent::render($request, $exception); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|