<?php

namespace App\Models;

use App\Libs\Database\Eloquent\ContentTypeModel;
use App\Models\GenericBackoffice\Traits\LanguageSupportTrait;

class Access extends ContentTypeModel
{
    CONST TYPE_HAS_ACCESS = [13];

    use LanguageSupportTrait;

    protected $hidden = ['languages', "websites"];
    protected $with = ['languages', "websites"];

    protected $fillable = [
        'external_id',
        'parent_id'
    ];

    public function properties() {
        return $this->belongsToMany(Property::class)->withPivot('position')->withTimestamps();
    }

    public function scopeAccessFilters($query) {
        return $query->whereIn('external_id', self::TYPE_HAS_ACCESS);
    }
}
