File: D:/HostingSpaces/SBogers10/netwerkbrabant.komma.pro/app/KommaApp/Questions/Models/Question.php
<?php
/**
*
*
* @author Komma <info@komma.pro>
* @copyright (c) 2012-2016, Komma
*/
namespace App\KommaApp\Questions\Models;
use App\KommaApp\Documents\DocumentsTrait;
use App\KommaApp\Documents\Kms\DocumentableInterface;
use App\KommaApp\Kms\Core\AbstractTranslatableModel;
use App\KommaApp\Kms\Core\Entities\DisplayNameTrait;
use App\KommaApp\Kms\Core\NestedSets\Nodes\AbstractTranslatableTreeModel;
use App\KommaApp\Kms\Core\NestedSets\Nodes\TreeModelLogicTrait;
use App\KommaApp\Languages\Models\Language;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Laravel\Scout\Searchable;
/**
* Class Question
*
* @package App\KommaApp\Questions\Models
* @property-read \App\KommaApp\Sites\Models\Site $site
* @mixin \Eloquent
* @property int $id
* @property int $active
* @property int|null $lft
* @property int|null $rgt
* @property int|null $tree
* @method static \Illuminate\Database\Eloquent\Builder|\App\KommaApp\Questions\Models\Question whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\KommaApp\Questions\Models\Question whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\KommaApp\Questions\Models\Question whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\KommaApp\Questions\Models\Question whereUpdatedAt($value)
*/
class Question extends AbstractTranslatableTreeModel
{
use DisplayNameTrait;
protected $table = 'questions';
protected $class = Question::class;
protected $fillable = ['active', 'site_id', 'lft', 'rgt', 'tree'];
/*
* Transient properties on Eloquent models
* These are not saved to database.
*/
public $thumbnail = false;
public function translations(): HasMany
{
return $this->hasMany(QuestionTranslation::class);
}
public function languages(): BelongsToMany
{
return $this->belongsToMany(Language::class, 'question_translations')
->withPivot('name', 'description')
->withTimestamps();
}
}