<?php

    namespace App\Models;

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

    class Block extends ContentTypeModel
    {
        use LanguageSupportTrait;
        use SpatialTrait;

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

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

        protected $casts = [];

        public function slider()
        {
            return $this->belongsToMany(SliderItem::class)->withPivot('position');
        }

        public function documentLists()
        {
            return $this->belongsToMany(DocumentList::class)->withPivot('position');
        }
    }
