<?php

namespace Modules\Common\Http\Controllers;

use Catch\Base\CatchController;
use Illuminate\Http\Request;
use Modules\Common\Repository\Options\Modules;

class ModuleController extends CatchController
{
    public function listApp(Request $request){
        if($this->getLoginUser()->roles->pluck('identify')->contains('channel')) {
            return Modules::getAppModules()->map(function ($module) {
                return [
                    'name' => $module['name'],
                    'title' => $module['title']
                ];
            });
        }
        return [];
    }
}
