File: D:/HostingSpaces/SBogers10/shop.komma.nl/app/Pages/Models/Page.php
<?php
namespace App\Pages\Models;
use Komma\KMS\Components\Component\ComponentableInterface;
use Komma\KMS\Components\Component\ComponentableTrait;
use Komma\KMS\Core\AbstractTranslatableModel;
use Komma\KMS\Core\Tree\NestedSets\Nodes\TreeModelInterface;
use Komma\KMS\Core\Tree\NestedSets\Nodes\TreeModelLogicTrait;
use Komma\KMS\Documents\DocumentsTrait;
use Komma\KMS\Documents\Kms\DocumentableInterface;
use Komma\KMS\Core\Entities\DisplayNameInterface;
use Komma\KMS\Core\Entities\DisplayNameTrait;
use Komma\KMS\Globalization\Languages\Models\Language;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Komma\KMS\Sites\HasSiteInterface;
use Komma\KMS\Sites\SiteTrait;
/**
* App\Pages\Models\Page
*
* @property int $id
* @property int $active
* @property string|null $code_name
* @property int $has_wildcard
* @property int|null $lft
* @property int|null $rgt
* @property int|null $tree
* @property int|null $site_id
* @property \Illuminate\Support\Carbon|null $created_at
* @property \Illuminate\Support\Carbon|null $updated_at
* @property-read \Illuminate\Database\Eloquent\Collection|\Komma\KMS\Components\Component\Component[] $components
* @property-read int|null $components_count
* @property-read \Illuminate\Database\Eloquent\Collection|\Komma\KMS\Documents\Models\Document[] $documents
* @property-read int|null $documents_count
* @property-read \Illuminate\Database\Eloquent\Collection|\Komma\KMS\Documents\Models\Document[] $images
* @property-read int|null $images_count
* @property-read \Illuminate\Database\Eloquent\Collection|Language[] $languages
* @property-read int|null $languages_count
* @property-read \App\Site\Site|null $site
* @property-read \App\Pages\Models\PageTranslation|null $translation
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Pages\Models\PageTranslation[] $translations
* @property-read int|null $translations_count
* @method static \Illuminate\Database\Eloquent\Builder|Page newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Page newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|Page query()
* @method static \Illuminate\Database\Eloquent\Builder|Page whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCodeName($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereHasWildcard($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereLft($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereRgt($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereSiteId($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTree($value)
* @method static \Illuminate\Database\Eloquent\Builder|Page whereUpdatedAt($value)
* @mixin \Eloquent
*/
final class Page extends AbstractTranslatableModel implements DocumentableInterface, DisplayNameInterface, ComponentableInterface, HasSiteInterface, TreeModelInterface
{
use DocumentsTrait;
use DisplayNameTrait;
use ComponentableTrait;
use TreeModelLogicTrait;
use SiteTrait;
protected $table = 'pages';
protected $class = Page::class;
protected $fillable = ['active', 'site_id', 'lft', 'rgt', 'tree', 'code_name', 'has_wildcard'];
/**
* Gets the translation models for this model
*
* @return HasMany that resolves to AbstractTranslationModel instances
*/
public function translations(): HasMany
{
return $this->hasMany(PageTranslation::class);
}
public function languages(): BelongsToMany
{
return $this->belongsToMany(Language::class, 'page_translations')
->withPivot('slug', 'name', 'description')
->withTimestamps();
}
}