<?php

namespace addons\webman\model;

use addons\webman\traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;

class AdminMenu extends Model
{
    use HasDateTimeFormatter;
    protected $fillable = ['name', 'icon', 'url', 'plugin', 'pid', 'sort', 'status', 'open'];

    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        $this->setTable(plugin()->webman->config('database.menu_table'));
    }

    protected function getNameAttribute($value)
    {
        return admin_trans('menu.titles.' . $value, $value);
    }
}
