File: D:/HostingSpaces/SBogers10/blije-gasten.komma.pro/app/Komma/Employees/Models/Employee.php
<?php
namespace App\Komma\Employees\Models;
use App\Komma\Documents\DocumentsTrait;
use App\Komma\Documents\Kms\DocumentableInterface;
use App\Komma\Globalization\Languages\Models\Language;
use App\Komma\Kms\Core\AbstractTranslatableModel;
use App\Komma\Kms\Core\Entities\DisplayNameInterface;
use App\Komma\Kms\Core\Entities\DisplayNameTrait;
use App\Komma\Sites\HasSitesInterface;
use App\Komma\Sites\Models\Site;
use App\Komma\Users\Models\SiteUser;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Support\Carbon;
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 \App\Komma\Globalization\Languages\Models\Language[] $languages
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Komma\Sites\Models\Site[] $sites
* @property-read \App\Komma\Employees\Models\EmployeeTranslation $translation
* @property-read \Illuminate\Database\Eloquent\Collection|\App\Komma\Employees\Models\EmployeeTranslation[] $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\Employees\Models\Employee whereActive($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Employees\Models\Employee whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Employees\Models\Employee whereDate($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Employees\Models\Employee whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Employees\Models\Employee 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\Employees\Models\Employee newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Employees\Models\Employee newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Komma\Employees\Models\Employee query()
*/
final class Employee extends AbstractTranslatableModel implements DocumentableInterface, DisplayNameInterface
{
use DocumentsTrait;
use DisplayNameTrait;
protected $table = 'employees';
protected $class = Employee::class;
protected $fillable = ['active', 'department', 'name'];
public const OFFICE = 1;
public const STAFF = 2;
public const EXTERNAL = 3;
/**
* Gets the translation models for this model
*
* @return HasMany that resolves to AbstractTranslationModel instances
*/
public function translations(): HasMany
{
return $this->hasMany(EmployeeTranslation::class);
}
public function languages(): BelongsToMany
{
return $this->belongsToMany(Language::class, 'employee_translations')
->withPivot('slug', 'name', 'description')
->withTimestamps();
}
}