<?php

    namespace App\Models;

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

    class ListBoxItem extends ContentTypeModel
    {
        use LanguageSupportTrait;

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

        protected $dates = []; // dates

        protected $casts = ['reference' => 'array'];

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

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

        public function block() {
            return $this->belongsToMany(Block::class, 'block_list_box_items','list_box_item_id', 'block_id')->withPivot('position');
        }
    }
