getStatusCode() === 403); if ( $isAuthException && (requestIsFromFrontend() && !$request->expectsJson() && !Auth::check()) ) { return redirect('/login'); } if ( $e instanceof AuthorizationException && $e->response() instanceof AccessResponseWithPermission && $e->response()->permission && Auth::check() && settings('billing.enable') ) { $permissionExistsInSubscriptionPlan = Product::with(['permissions']) ->get() ->some(function ($product) use ($e) { // check if there's a plan that has this permission and if user is not already on this plan return $product->permissions->contains( 'name', $e->response()->permission, ) && Auth::user()->subscriptions->first()?->product_id !== $product->id; }); if ($permissionExistsInSubscriptionPlan) { return Auth::user()->subscribed() ? redirect('/billing') : redirect('/pricing'); } } return parent::render($request, $e); } public function register() { if (config('app.env') !== 'production') { return; } $this->renderable(function (ErrorException $e) { if ( Str::contains($e->getMessage(), [ 'failed to open stream: Permission denied', 'mkdir(): Permission denied', ]) ) { return $this->filePermissionResponse($e); } }); configureScope(function (Scope $scope): void { $scope->setContext('app_name', ['value' => config('app.name')]); }); $this->reportable(function (Throwable $e) { Integration::captureUnhandledException($e); }); } protected function convertExceptionToArray(Throwable $e): array { $previous = $e->getPrevious(); $isValidationException = $e instanceof HttpException && $e->getStatusCode() === 422; $isExceptionWithAction = $previous && method_exists($previous, 'response') && $previous->response() && property_exists($previous->response(), 'action'); if ( config('app.debug') && !config('common.site.demo') && !$isValidationException ) { $array = $this->ignitionReportFromThrowable($e); } else { $array = parent::convertExceptionToArray($e); } if ($isExceptionWithAction) { $array['action'] = $e->getPrevious()->response()->action; } if ($array['message'] === 'Server Error') { $array['message'] = __( 'There was an issue. Please try again later.', ); } if ($array['message'] === 'This action is unauthorized.') { $array['message'] = __( "You don't have required permissions for this action.", ); } return $array; } protected function filePermissionResponse(ErrorException $e) { if (request()->expectsJson()) { return response()->json(['message' => 'test']); } else { preg_match('/\((.+?)\):/', $e->getMessage(), $matches); $path = $matches[1] ?? null; // should not return a view here, in case laravel views folder is not readable as well return response( "
See the article here for possible solutions: https://support.vebto.com/hc/articles/207/changing-file-permissions