File: D:/HostingSpaces/stafa/werkenbijstafa.nl/app/Komma/Buttons/Models/Button.php
<?php
/**
*
*
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
namespace App\Komma\Buttons\Models;
use App\Komma\Components\Component\ComponentableInterface;
use App\Komma\Components\Component\ComponentableTrait;
use App\Komma\Documents\DocumentsTrait;
use App\Komma\Documents\Kms\DocumentableInterface;
use App\Komma\Kms\Core\AbstractTranslatableModel;
use App\Komma\Kms\Core\Entities\DisplayNameInterface;
use App\Komma\Kms\Core\Entities\DisplayNameTrait;
use App\Komma\Languages\Models\Language;
use App\Komma\Sites\HasSitesInterface;
use App\Komma\Sites\Models\Site;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Str;
/**
* Class Page
*
* @package App\Komma\Pages\Models
* @property int site_id
* @property int lft
* @property int rgt
* @property int tree
* @property-read \Carbon $date
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Komma\Languages\Models\Language[] $languages
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Komma\Sites\Models\Site[] $sites
* @property-read \App\Komma\Buttons\Models\ButtonTranslation $translation
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Komma\Buttons\Models\ButtonTranslation[] $translations
* @mixin \Eloquent
* @property int $id
* @property int $active
* @property \Carbon\Carbon|null $created_at
* @property \Carbon\Carbon|null $updated_at
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button whereDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button whereUpdatedAt($value)
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Komma\Documents\Models\Document[] $documents
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Komma\Documents\Models\Document[] $images
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Buttons\Models\Button query()
*/
final class Button extends AbstractTranslatableModel implements HasSitesInterface, ComponentableInterface, DocumentableInterface, DisplayNameInterface
{
use DocumentsTrait;
use DisplayNameTrait;
use ComponentableTrait;
protected $table = 'buttons';
protected $class = Button::class;
protected $fillable = ['active', 'site_id'];
/**
* Gets the translation models for this model
*
* @return HasMany that resolves to AbstractTranslationModel instances
*/
public function translations(): HasMany
{
return $this->hasMany(ButtonTranslation::class);
}
public function languages(): BelongsToMany
{
return $this->belongsToMany(Language::class, 'button_translations')
->withPivot('slug', 'name', 'description')
->withTimestamps();
}
/**
* Get the site or sites for this model
*
* @return BelongsToMany
*/
public function sites(): BelongsToMany
{
return $this->belongsToMany(Site::class);
}
}