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/azenio.komma.pro/vendor/komma/kms/src/Core/ModelServiceInterface.php
<?php declare(strict_types=1);

namespace Komma\KMS\Core;

use Komma\KMS\Core\Tree\NestedSets\Nodes\TreeModelInterface;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;


/**
 * Interface ModelService
 *
 * Does know how to work with eloquent models.
 *
 * @package App\Kms\Core
 */
interface ModelServiceInterface extends AbstractModelHandlerInterface
{
    /**
     * Sets the for forModelInstance variable to the model that is in the route, if it matches the singular form
     * of the slug string variable. If it does not match, forModelInstance will remain null. Take this into account
     * in other methods.
     *
     * @return Model
     */
    public function getForModelFromRoute($slug): ? Model;

    /**
     * This method will create a new model instance.
     *
     * @return Model
     */
    public function newModel(): Model;

    /**
     * Gets the model query
     *
     * @return \Illuminate\Database\Query\Builder
     */
    public function models();

    /**
     * This method will build an model tree.
     * Used by the Controllers get and set-structure method
     *
     * @return Model|TreeModelInterface
     */
    public function getRootModelForTree(): ?Model;

    /**
     * Uses the siteService and the Tree service to create a root model if the model uses a tree algorithm
     */
    public function createRootTreeModelIfNeeded();

    public function getOptionsForSelect(bool $allowNullableSelectOption = false);

    public function getOptionsForSelectAsTree(): Collection;

    /**
     * Returns all models for the sidebar menu in the backend
     *
     * @return array
     */
    public function getModelsForSideBar(): array;

    /**
     * @return string
     */
    public function getModelClassName(): string;

    /**
     * @param string $modelClassName
     * @return void
     */
    public function setModelClassName(string $modelClassName): void;

    /**
     * Generates a route string for saving a new or existing route. And generates the correct http verb for it.
     *
     * @param int|null $modelId In a route of /kms/default/pages/89 the modelId is 89. Referencing to a page for example.
     * @param string $slug In a route of /kms/default/pages/89 the slug is 'pages'. default is the site name
     * @return array with 2 keys. route and method.
     */
    public function getSaveRoute(string $slug, int $modelId = null);
}