<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class MenuGroup extends Model
{
    use HasFactory;
    protected $table = 'tbl_menu_grp';
    protected $fillable = [];
    public $timestamps = false;

    protected $primaryKey = 'id';


    public function getMenuNamesAttribute()
    {
        $menuIds = json_decode($this->menu_name, true) ?? [];
        return \App\Models\Menu::whereIn('id', $menuIds)
            ->pluck('label')
            ->implode(', ');
    }


}
