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/beerten.komma.nl/vendor/komma/kms/src/Core/Tree/TreeServiceInterface.php
<?php declare(strict_types=1);

namespace Komma\KMS\Core\Tree;

use Illuminate\Database\Eloquent\Model;
use Komma\KMS\Core\AbstractModelHandlerInterface;
use Komma\KMS\Core\Tree\NestedSets\Nodes\TreeModelInterface;
use Closure;


/**
 * Does know how to work with TreeModelInterface models.
 */
interface TreeServiceInterface extends AbstractModelHandlerInterface
{
    /**
     * @param string $className
     */
    public function setClassModelName(string $className);

    /**
     * Return the models represented by modelClassName as a TreeResource.
     * Can be converted to json for api calls
     *
     * @param TreeModelInterface $rootModel
     * @return TreeResource
     */
    public function getStructure(TreeModelInterface $rootModel);

    /**
     * @param $dataStructure
     */
    public function setStructure($dataStructure);

    /**
     * Make sure the classModelName variable was set to a Model child
     *
     * @return mixed|void
     */
    public function checkClassModelNameSet();

    /**
     * Creates a root model in the database for the for model fully qualified class name if it isn't there yet.
     * But only if it implements the TreeModelInterface
     * And returns the TreeModelInterface
     *
     * @param string $FQCN
     * @param array|null $extraData Extra attributes with their values to fill in the model when the root model does not exist and has to be created
     * @param Closure|null $existsQueryClosure An optional closure that must accept a query builder instance for constraining the query to check if the root model exists
     * @return TreeModelInterface|Null
     */
    public function makeRootModelIfNeeded(
        string $FQCN,
        array $extraData = null,
        Closure $existsQueryClosure = null
    ): ? TreeModelInterface;

    /**
     * @param Model $model
     * @param Closure $callback
     */
    public function destroyForModelAndExecuteCallbackForeach(Model $model, \Closure $beforeCallback);
}