load($filename); if (!$notificacion) { $notificacion = (object) [ 'title' => '', 'text' => '', 'active' => false ]; } return $view->render($response, 'admin.notificacion.show', compact('notificacion')); } public function do_edit(Request $request, Response $response, View $view, Filemanager $filemanager): Response { $post = $request->getParsedBody(); $filename = 'notificacion.yml'; $notificacion = $filemanager->load($filename); if (!$notificacion) { $notificacion = (object) [ 'title' => '', 'text' => '', 'active' => false ]; } $notificacion->title = $post['title']; $notificacion->text = $post['text']; $notificacion->active = (isset($post['active']) and $post['active'] == 'on') ? true : false; $filemanager->save($filename, $notificacion); return $response ->withHeader('Location', implode('/', [ $container->get('urls.base'), 'admin', 'notificacion' ])) ->withStatus(302); } }