HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/farmfun.komma.pro/app/Komma/Documents/Kms/DocumentServiceInterface.php
<?php

declare(strict_types=1);

namespace App\Komma\Documents\Kms;

use App\Komma\Documents\Models\Document;
use App\Komma\Kms\Core\AbstractModelHandlerInterface;
use App\Komma\Kms\Core\Attributes\Documents;
use App\Komma\Kms\Core\Attributes\Models\ImageProperty;
use App\Komma\Kms\Core\Sections\AbstractAttributeKey;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Collection;

/**
 * Class DocumentService
 *
 * Manages uploads
 */
interface DocumentServiceInterface extends AbstractModelHandlerInterface
{
    /**
     * Retrieves the uploaded documents and stores them in the filesystem and database by delegating to other methods
     *
     * @param Model $model
     * @param Documents $attribute
     * @param AbstractAttributeKey $beforeSaveKey The key of the attribute before it was saved. If you don't specify it, the attribute key will be used.
     * @param AbstractAttributeKey $afterSaveKey The key of the attribute after it was saved. If you don't specify it, the attribute key will be used.
     */
    public function processUploadedDocumentsForModel(
        Model $model,
        Documents $attribute,
        AbstractAttributeKey $beforeSaveKey = null,
        AbstractAttributeKey $afterSaveKey = null
    );

    /**
     * Store an html 5 uploaded file
     *
     * @param UploadedFile $file
     * @param string $subFolder the subfolder of the public uploads folder where to store this file
     * @param array $imageProperties
     * @return Document
     */
    public function storeHtml5Upload(UploadedFile $file, string $subFolder, array $imageProperties): Document;

    /**
     * Link a specific file to a model as a document.
     *
     * @param Model $model
     * @param string $absoluteFileSourcePath
     * @param string $uploadsSubFolder
     * @param ImageProperty[] $imageProperties
     * @param $key
     */
    public function linkFileToModelAsDocument(
        Model $model,
        string $absoluteFileSourcePath,
        string $uploadsSubFolder,
        array $imageProperties,
        $key
    );

    /**
     * Checks if a filename is linked to a model
     *
     * @param Model $model
     * @param $name
     * @return bool
     */
    public function fileLinkedForModel(Model $model, $name);

    /**
     * Deletes the specified documents and their related files
     *
     * @param $documents
     */
    public static function deleteDocuments(Collection $documents);

    /**
     * Uses the key (for example Documents-documents) to scan for uploaded documents by appending -1, -2, -3 etc to the key name.
     * and then using the \Input facade to retrieve it. Then stores all the uploaded files in their corresponding Document models.
     * Also gets the json version of all models in a form using $key input field, looks at those json versions state attributes
     * and either gets them from the database or makes a new document.
     *
     * @param string $key
     * @return Collection
     */
    public function getDocumentsUsingAttributeKey(string $key):Collection;
}