<?php

    namespace App\Models;

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

    class SoftwareVersion extends ContentTypeModel
    {
        use LanguageSupportTrait;

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

        protected $dates = []; // dates

        protected $casts = [];

        public function windowsVersions() {
            return $this->belongsToMany(WindowsVersion::class, 'block_windows_versions', 'block_id', 'windows_version_id')->withPivot('position')->withTimestamps();
        }

        public function macVersions() {
            return $this->belongsToMany(MacVersion::class, 'block_mac_versions', 'block_id', 'mac_version_id')->withPivot('position')->withTimestamps();
        }

        public function linuxVersions() {
            return $this->belongsToMany(LinuxVersion::class, 'block_linux_versions', 'block_id', 'linux_version_id')->withPivot('position')->withTimestamps();
        }

        public function androidVersions() {
            return $this->belongsToMany(AndroidVersion::class, 'block_android_versions', 'block_id', 'android_version_id')->withPivot('position')->withTimestamps();
        }

    }
