<?php

    namespace App\Models\GenericBackoffice;

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

    class Entry extends ContentTypeModel
    {
        use LanguageSupportTrait;

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

        protected $dates = []; // dates
        protected $spatialFields = []; // Locations lat & longs

        protected $casts = [];

        public function blocks() {
            return $this->belongsToMany(\App\Models\Block::class)->withPivot('position')->withTimestamps();
        }

        public function metaImage() {
            return $this->belongsTo(MediaItem::class);
        }

        public function image() {
            return $this->belongsTo(MediaItem::class);
        }

        public function bottomImage() {
            return $this->belongsTo(MediaItem::class);
        }

        public function partners() {
            return $this->belongsToMany(\App\Models\Partner::class)->withPivot('position')->withTimestamps();
        }

        public function mediaVideos() {
            return $this->belongsToMany(\App\Models\MediaVideo::class)->withPivot('position')->withTimestamps();
        }
    }
