delete submitted application form before

parent 41c19ea8
......@@ -36,4 +36,16 @@ return function (Slim\App $app) {
return $logger;
});
}, -10);
$events('on', 'app.bootstrap', function ($app, $container) {
$container->get('router')->getNamedRoute('application_form')->add(function ($req, $res, $next) {
$school_id = $req->getAttribute('school')->id;
$appForm = RedBeanPHP\R::findOne('applicationform', 'school_id = ?', [$school_id]);
if ($appForm) {
RedBeanPHP\R::trash($appForm);
}
return $next($req, $res);
});
}, -10);
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment