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/ehbo.today/app/KommaApp/Sites/SiteServiceInterface.php
<?php

namespace App\KommaApp\Sites;

use App\KommaApp\Kms\Core\NestedSets\Nodes\TreeModelInterface;
use App\KommaApp\Kms\Core\Sections\SectionServiceInterface;
use App\KommaApp\Sites\Models\Site;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

/**
 * Represents a service that can do all kinds of things with the site model.
 * Make sure you use only 1 instance of this service throughout the whole application because it keeps track of the current site.
 * So handle it like a singleton using the IOC DI service container of laravel.
 *
 * Interface SiteServiceInterface
 * @package App\KommaApp\Sites
 */
interface SiteServiceInterface extends SectionServiceInterface
{
    /**
     * This method will get a specific site
     *
     * @param integer $id
     * @return Site
     */
    public function getSite($id = 1): Site;

    /**
     * This method will get all the sites
     *
     * @return Collection|static[]
     */
    public function getSites();

    /**
     * Returns an array if integers or a csv string if asString is true representing the sites
     * of a model or return null if the model does not have sites
     *
     * @param Model $model
     * @param bool $asString
     * @return null|array|string
     */
    public function getSiteIdsForModel(Model $model, bool $asString = true);

    /**
     * Makes the AbstractTranslatableModel a child from the sites by id if it isn't a child yet
     *
     * @param HasSitesInterface $model
     * @param string $siteIds comma seperated like this 1,4,2,5 or nothing or an empty string if you don't want to link the model to sites anymore
     */
    public function linkModelToSitesUsingIdCsvString(HasSitesInterface $model, string $siteIds): void;

    /**
     * Makes the AbstractTranslatableModel a child from the sites by id if it isn't a child yet.
     *
     * @param HasSiteInterface $model
     * @param int $siteId the id of a site you want to link the model to or null of you don't want to link it to a site anymore
     */
    public function linkModelToSiteWithId(HasSiteInterface $model, int $siteId = null): void;

    /**
     * Links a given model to the current site if it is needed.
     * It is needed when the model implements the HasSitesInterface
     * as a belongsTo relationship AND if this service holds a "current site" that is not the default site
     *
     * @param Model $model
     */
    public function linkModelToCurrentSite(Model $model);

    /**
     * Set the site to the default / first one available
     *
     */
    public function setCurrentSiteToDefault();

    /**
     * Sets the site you are currently using
     *
     * @param $siteSlug
     */
    public function setCurrentSiteBySlug($siteSlug);

    /**
     * Gets the site you are currently using
     *
     * @return Site
     */
    public function getCurrentSite();

    /**
     * Get the default language id of the current site
     *
     * @return int
     */
    public function getCurrentSiteDefaultLanguage(): int;


    /**
     * Returns the current site's languages
     *
     * @return Collection of Language
     */
    public function getSiteLanguages(): Collection;
}