with(['pressRelease' => fn ($query) => $query ->withoutGlobalScopes() ->with(['company' => fn ($company) => $company->withoutGlobalScopes()])]) ->findOrFail($image); $pressRelease = $image->pressRelease; abort_unless($pressRelease instanceof PressRelease, 404); $isPublic = $this->pressReleaseMediaIsPublic($pressRelease); $this->authorizePressReleaseMediaAccess($request, $pressRelease, $isPublic); $path = $image->pathForVariant($variant); abort_unless(is_string($path) && filled($path), 404); return Storage::disk($image->disk)->response($path, headers: [ 'Cache-Control' => $this->mediaCacheControl($isPublic), 'X-Content-Type-Options' => 'nosniff', ]); } }