File: D:/HostingSpaces/Neopoints/momsecurity.be/app/Komma/Sites/SiteServiceInterface.php
<?php
namespace App\Komma\Sites;
use App\Komma\Kms\Core\NestedSets\Nodes\TreeModelInterface;
use App\Komma\Kms\Core\Sections\SectionServiceInterface;
use App\Komma\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\Komma\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;
}