HEX
Server: LiteSpeed
System: Linux sv4.hami.host 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User: armgroup (1008)
PHP: 8.2.32
Disabled: show_source, system, shell_exec, passthru, exec, popen, proc_open, mail, socket_create, socket_create_listen, socket_create_pair, link, dl, openlog, syslog, stream_socket_server, curl_multi_init
Upload Files
File: /home/armgroup/libs/app/MenuFactory.php
<?php

namespace App;

class MenuFactory
{
    public static function build()
    {
        $menus = [
            [
                'label' => 'داشبورد',
                'permissions' => ['dashboard access'],
                'icon' => 'dashboard',
                'route_name' => 'admin.index',
            ],
            [
                'label' => 'دسته‌بندی‌ها',
                'permissions' => ['manage categories'],
                'icon' => 'list-alt',
                'route_name' => 'admin.categories.index',
            ],
            [
                'label' => 'تگ‌ها',
                'permissions' => ['manage tags'],
                'icon' => 'tag',
                'route_name' => 'admin.tags.index',
            ],
            [
                'label' => 'نظرات',
                'permissions' => ['manage comments'],
                'icon' => 'comments',
                'route_name' => 'admin.comments.index',
            ],
            //            [
            //                'label' => 'پرداخت‌های آسان',
            //                'permissions' => ['manage easy pays'],
            //                'icon' => 'dollar',
            //                'route_name' => 'admin.easy-pays.index',
            //            ],
            [
                'label' => 'فروشگاه',
                'permissions' => [''],
                'icon' => 'tags',
                'children' => [
                    [
                        'route_name' => 'admin.brands.index',
                        'label' => 'برندها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage brands'],
                    ],
                    //                    [
                    //                        'route_name' => 'admin.authors.index',
                    //                        'label' => 'نویسندگان',
                    //                        'icon' => 'circle-o',
                    //                        'permissions' => ['manage authors'],
                    //                    ],
                    [
                        'route_name' => 'admin.attribute-groups.index',
                        'label' => 'ویژگی‌ها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage attributes'],
                    ],
                    [
                        'route_name' => 'admin.options.index',
                        'label' => 'گزینه‌ها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage options'],
                    ],
                    [
                        'route_name' => 'admin.products.index',
                        'label' => 'محصولات',
                        'icon' => 'circle-o',
                        'permissions' => ['manage products'],
                    ],
                    [
                        'route_name' => 'admin.discounts.index',
                        'label' => 'کدهای تخفیف',
                        'icon' => 'circle-o',
                        'permissions' => ['manage discounts'],
                    ],
                ],
            ],
            [
                'label' => 'سفارشات',
                'permissions' => [''],
                'icon' => 'shopping-bag',
                'children' => [
                    [
                        'route_name' => 'admin.orders.index',
                        'label' => 'تمام سفارشات',
                        'icon' => 'circle-o',
                        'permissions' => ['manage all orders'],
                    ],
                ],
            ],
            [
                'label' => 'گزارشات',
                'permissions' => [''],
                'icon' => 'line-chart',
                'children' => [
                    [
                        'route_name' => 'admin.reports.logs',
                        'label' => 'جزئیات فروش',
                        'icon' => 'circle-o',
                        'permissions' => ['manage reports'],
                    ],
                    [
                        'route_name' => 'admin.reports.charts',
                        'label' => 'نمودارهای فروش',
                        'icon' => 'circle-o',
                        'permissions' => ['manage reports'],
                    ],
                    [
                        'route_name' => 'admin.favorites.index',
                        'label' => 'علاقه‌مندی‌ها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage reports'],
                    ],
                    [
                        'route_name' => 'admin.product-demands.index',
                        'label' => 'تقاضای موجود کردن',
                        'icon' => 'circle-o',
                        'permissions' => ['manage reports'],
                    ],
                ],
            ],
            [
                'label' => 'پشتیبانی',
                'permissions' => [''],
                'icon' => 'ticket',
                'children' => [
                    [
                        'route_name' => 'admin.tickets.index',
                        'label' => 'تیکت‌ها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage tickets'],
                    ],
                    [
                        'route_name' => 'admin.contacts.index',
                        'label' => 'تماس با ما',
                        'icon' => 'circle-o',
                        'permissions' => ['manage contacts'],
                    ],
                ],
            ],
            [
                'label' => 'محتوا',
                'permissions' => [''],
                'icon' => 'newspaper-o',
                'children' => [
                    [
                        'route_name' => 'admin.pages.index',
                        'label' => 'صفحات',
                        'icon' => 'circle-o',
                        'permissions' => ['manage pages'],
                    ],
                    [
                        'route_name' => 'admin.articles.index',
                        'label' => 'بلاگ',
                        'icon' => 'circle-o',
                        'permissions' => ['manage articles'],
                    ],
                    [
                        'route_name' => 'admin.faqs.index',
                        'label' => 'سوالات متداول',
                        'icon' => 'circle-o',
                        'permissions' => ['manage faqs'],
                    ],
                ],
            ],
            [
                'label' => 'کاربران',
                'permissions' => [''],
                'icon' => 'users',
                'children' => [
                    [
                        'route_name' => 'admin.organizations.index',
                        'label' => 'سازمان‌ها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage organizations'],
                    ],
                    [
                        'route_name' => 'admin.users.index',
                        'label' => 'لیست کاربران',
                        'icon' => 'circle-o',
                        'permissions' => ['manage users'],
                    ],
                    [
                        'route_name' => 'admin.roles.index',
                        'label' => 'نقش‌های کاربری',
                        'icon' => 'circle-o',
                        'permissions' => ['manage roles'],
                    ],
                    [
                        'route_name' => 'admin.activities.index',
                        'label' => 'فعالیت کاربران',
                        'icon' => 'circle-o',
                        'permissions' => ['manage activities'],
                    ],
                ],
            ],
            //            [
            //                'label' => 'خبرنامه',
            //                'permissions' => [''],
            //                'icon' => 'envelope-open-o',
            //                'children' => [
            //                    [
            //                        'route_name' => 'admin.newsletter-members.index',
            //                        'label' => 'اعضا',
            //                        'icon' => 'circle-o',
            //                        'permissions' => ['manage newsletter members'],
            //                    ],
            //                ],
            //            ],
            [
                'label' => 'حمل و نقل',
                'permissions' => [''],
                'icon' => 'truck',
                'children' => [
                    [
                        'route_name' => 'admin.provinces.index',
                        'label' => 'استان‌ها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage provinces'],
                    ],
                    [
                        'route_name' => 'admin.shipping-prices.index',
                        'label' => 'هزینه‌های ارسال',
                        'icon' => 'circle-o',
                        'permissions' => ['manage shipping prices'],
                    ],
                    [
                        'route_name' => 'admin.sending-days.index',
                        'label' => 'روزهای ارسال',
                        'icon' => 'circle-o',
                        'permissions' => ['manage sending days'],
                    ],
                ],
            ],
            [
                'label' => 'سیستم',
                'permissions' => [''],
                'icon' => 'cog',
                'children' => [
                    [
                        'route_name' => 'admin.settings.index',
                        'label' => 'تنظیمات',
                        'icon' => 'circle-o',
                        'permissions' => ['manage settings'],
                    ],
                    [
                        'route_name' => 'admin.banners.index',
                        'label' => 'بنرها',
                        'icon' => 'circle-o',
                        'permissions' => ['manage banners'],
                    ],
                    [
                        'route_name' => 'admin.menus.index',
                        'label' => 'منوساز',
                        'icon' => 'circle-o',
                        'permissions' => ['manage menus'],
                    ],
                ],
            ],
        ];

        $currentRouteName = app('router')->getCurrentRoute()->getName();

        foreach ($menus as &$menu) {
            if (isset($menu['route_name']) && $currentRouteName == $menu['route_name']) {
                $menu['active'] = true;
            }

            if (! empty($menu['children'])) {
                foreach ($menu['children'] as &$child) {
                    if ($currentRouteName == $child['route_name']) {
                        $menu['active'] = true;
                        $child['active'] = true;
                    }

                    $menu['permissions'] = array_unique(array_merge($menu['permissions'], $child['permissions']));
                }
            }
        }

        return $menus;
    }
}