<?php

namespace App\Models;

use App\Libs\Database\Eloquent\ContentTypeModel;
use App\Models\GenericBackoffice\Traits\LanguageSupportTrait;
use App\Traits\Indexable;
use App\Traits\ThrowsIndexation;
use App\Traits\Favouritable;
use App\Traits\WithShareUrl;


class Artist extends ContentTypeModel
{
    use LanguageSupportTrait;
    use Indexable;
    use ThrowsIndexation;
    use Favouritable;
    use WithShareUrl;


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

    protected $dates = []; // dates
    protected $casts = [];

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

    public function exhibitions()
    {
        return $this->belongsToMany(Exhibition::class);
    }


    public function collections()
    {
        return $this->belongsToMany(Collection::class);
    }

    public function news()
    {
        return $this->belongsToMany(NewsItem::class);
    }

    /**
     * Get all of the tags for the artist.
     */
    public function tags()
    {
        return $this->morphToMany(Tag::class, 'taggable');
    }
}
