96 lines
2.8 KiB
PHP
96 lines
2.8 KiB
PHP
<?php
|
|
|
|
namespace Modules\Portal\Http\Controllers;
|
|
|
|
use App\Http\MenuIcons;
|
|
use App\Utils\ModuleUtil;
|
|
use Illuminate\Routing\Controller;
|
|
use Menu;
|
|
use Modules\Portal\Utils\PortalUtil;
|
|
|
|
class DataController extends Controller
|
|
{
|
|
public function modifyAdminMenu()
|
|
{
|
|
$business_id = (int) session()->get('user.business_id');
|
|
$user = auth()->user();
|
|
|
|
if (! $user->can('superadmin') && ! $user->can('portal.settings.manage')) {
|
|
return;
|
|
}
|
|
|
|
$hasAnyPortal = false;
|
|
$moduleUtil = new ModuleUtil();
|
|
foreach (PortalUtil::portals() as $portal) {
|
|
if (PortalUtil::hasPortalSubscription($business_id, $portal, $moduleUtil)) {
|
|
$hasAnyPortal = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (! $hasAnyPortal) {
|
|
return;
|
|
}
|
|
|
|
Menu::modify('admin-sidebar-menu', function ($menu) {
|
|
$menu->url(
|
|
action([\Modules\Portal\Http\Controllers\SettingsController::class, 'index']),
|
|
__('portal::lang.portal_settings'),
|
|
[
|
|
'icon' => MenuIcons::svg('portal'),
|
|
'active' => request()->segment(1) == 'portal' && request()->segment(2) == 'admin',
|
|
'data-module' => 'Portal',
|
|
'data-menu-group' => 'integrations',
|
|
]
|
|
)->order(88);
|
|
});
|
|
}
|
|
|
|
public function user_permissions()
|
|
{
|
|
return [
|
|
[
|
|
'value' => 'portal.customer.access',
|
|
'label' => __('portal::lang.access_customer_portal'),
|
|
'default' => false,
|
|
],
|
|
[
|
|
'value' => 'portal.supplier.access',
|
|
'label' => __('portal::lang.access_supplier_portal'),
|
|
'default' => false,
|
|
],
|
|
[
|
|
'value' => 'portal.marketer.access',
|
|
'label' => __('portal::lang.access_marketer_portal'),
|
|
'default' => false,
|
|
],
|
|
[
|
|
'value' => 'portal.settings.manage',
|
|
'label' => __('portal::lang.manage_portal_settings'),
|
|
'default' => false,
|
|
],
|
|
];
|
|
}
|
|
|
|
public function superadmin_package()
|
|
{
|
|
return [
|
|
[
|
|
'name' => 'customer_portal_module',
|
|
'label' => __('portal::lang.customer_portal_module'),
|
|
'default' => false,
|
|
],
|
|
[
|
|
'name' => 'supplier_portal_module',
|
|
'label' => __('portal::lang.supplier_portal_module'),
|
|
'default' => false,
|
|
],
|
|
[
|
|
'name' => 'marketer_portal_module',
|
|
'label' => __('portal::lang.marketer_portal_module'),
|
|
'default' => false,
|
|
],
|
|
];
|
|
}
|
|
}
|