<?php

namespace App\Models;

use App\Models\Traits\LanguageSupportTrait;
use App\Models\Entry;

class MenuItem extends BaseModel
{
    use LanguageSupportTrait;

    protected $with = array("languages");

    public function menu()
    {
        return $this->belongsTo(Menu::class);
    }

    public function parent()
    {
        return $this->belongsTo(MenuItem::class, 'parent_id');
    }

    public function entry()
    {
        return $this->belongsTo(Entry::class);
    }

    public function children()
    {
        return $this->hasMany(MenuItem::class, 'parent_id');
    }

    public function bigMenu()
    {
        return $this->belongsTo(BigMenu::class);
    }

    public function websiteObject()
    {
        return $this->belongsTo(WebsiteObject::class, 'website_object_id', 'website_object_id');
    }
}
