File: D:/HostingSpaces/SBogers10/eleo.komma.nl/vendor/komma/kms/src/Sites/SiteServiceInterface.php
<?php
namespace Komma\KMS\Sites;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Collection;
use Komma\KMS\Core\AbstractModelHandlerInterface;
use Komma\KMS\Sites\Models\Site;
use Illuminate\Database\Eloquent\Collection as DatabaseCollection;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection as BaseCollection;
use Komma\KMS\Sites\Models\SiteInterface;
/**
* 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\Sites
*/
interface SiteServiceInterface extends AbstractModelHandlerInterface
{
/**
* This method will get a specific site
*
* @param integer $id
* @return SiteInterface
*/
public function getSite($id = 1): Site;
/**
* This method will get all the sites
*
* @param bool $force Whether to force (re)loading sites from the database or use an internal cached set.
* @return DatabaseCollection|static[]
*/
public function getSites($force = false);
/**
* 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 SiteInterface
*/
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;
/**
* @return Builder
*/
public function languagesHavingSites(): Builder;
/**
* @param bool $allowNullableSelectOption
* @return BaseCollection
*/
public function getOptionsForSelect(bool $allowNullableSelectOption = false): BaseCollection;
}