BookStack\Http\Controllers\AttachmentController::get PHP Метод

get() публичный Метод

Get an attachment from storage.
public get ( $attachmentId ) : Illuminate\Contracts\Routing\ResponseFactory | Illuminate\Http\RedirectResponse | Redirector | Response
$attachmentId
Результат Illuminate\Contracts\Routing\ResponseFactory | Illuminate\Http\RedirectResponse | Illuminate\Routing\Redirector | Symfony\Component\HttpFoundation\Response
    public function get($attachmentId)
    {
        $attachment = $this->attachment->findOrFail($attachmentId);
        $page = $this->pageRepo->getById($attachment->uploaded_to);
        $this->checkOwnablePermission('page-view', $page);
        if ($attachment->external) {
            return redirect($attachment->path);
        }
        $attachmentContents = $this->attachmentService->getAttachmentFromStorage($attachment);
        return response($attachmentContents, 200, ['Content-Type' => 'application/octet-stream', 'Content-Disposition' => 'attachment; filename="' . $attachment->getFileName() . '"']);
    }