Backend\ModuleBuilderController::formDropdownSources PHP Метод

formDropdownSources() приватный Метод

private formDropdownSources ( $module_id = null ) : array
$module_id
Результат array
    private function formDropdownSources($module_id = null)
    {
        $select = array('Same as in form');
        if ($module_id) {
            // Exclude the currently being edited module
            $all_modules = BuiltModule::whereNotIn('id', array($module_id))->latest();
        } else {
            $all_modules = BuiltModule::latest();
        }
        $all_modules = $all_modules->get(array('id', 'name', 'form_id', 'models'));
        foreach ($all_modules as $this_module) {
            if ($this_module->models) {
                $models = json_decode($this_module->models);
                foreach ($models as $model => $model_text) {
                    $select[$this_module->name][$this_module->id . '-' . $model] = $model_text;
                }
            } else {
                $form_ids = explode(', ', $this_module->form_id);
                foreach ($form_ids as $form_id) {
                    $form = BuiltForm::find($form_id);
                    if (isset($form)) {
                        $select[$this_module->name][$this_module->id . '-' . $form->id] = $form->name;
                    }
                }
            }
        }
        return $select;
    }