getModel(); if (Str::endsWith($model, 'Texture')) { $exception = new ModelNotFoundException(trans('skinlib.non-existent')); } } elseif ($exception instanceof MissingScopeException) { return json($exception->getMessage(), 403); } return parent::render($request, $exception); } protected function convertExceptionToArray(Throwable $e) { return [ 'message' => $e->getMessage(), 'exception' => true, 'trace' => collect($e->getTrace()) ->map(fn ($trace) => Arr::only($trace, ['file', 'line'])) ->filter(fn ($trace) => Arr::has($trace, 'file')) ->map(function ($trace) { $trace['file'] = str_replace(base_path().DIRECTORY_SEPARATOR, '', $trace['file']); return $trace; }) ->filter(function ($trace) { // @codeCoverageIgnoreStart $isFromPlugins = !app()->runningUnitTests() && Str::contains($trace['file'], resolve('plugins')->getPluginsDirs()->all()); // @codeCoverageIgnoreEnd return Str::startsWith($trace['file'], 'app') || $isFromPlugins; }) ->values(), ]; } }