public function edit($modelName) { if (!($model = Config::getModelByClassName($modelName))) { throw new \Exception('Model does not exist'); } return view('elegant::admin.modelsettings.edit', ['model' => $model]); }
/** * @param ReflectionClass $class * @return ElegantModelInterface|null */ protected function getTranslatedModel(ReflectionClass $class) { $method = $class->getMethod('getTranslationModelName'); $translationModelName = $method->invoke($class->newInstance()); if ($model = Config::getModelByClassName($translationModelName)) { return $model; } else { return null; } }
/** * @param Model $model * @return string */ protected function getRelatedModelAsLink(Model $model) { $elegantModel = Config::getModelByClassName(get_class($model)); $modelString = e($elegantModel->getModelAsString($model)); return "<a href=\"{$elegantModel->getUrl($model)}\">{$modelString}</a>"; }