<?php
namespace App\Models;

class Menu extends BaseModel
{
    protected $table = 'menus';
    protected $fillable = ['parent_id', 'title', 'icon' ,'uri' ,'permission_name' ,'sort' ,'status' ,'type' ];

    const TYPE_MENU = 1;
    const TYPE_BUTTON = 2;

    const STATUS_SHOW = 1;
    const STATUS_HIDE = 2;

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

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