}); $app->post('/card/create', function () use($app) { $data = $app->request()->post('generator'); $card = new models\Card(); $card->create($data); $app->redirect('/cards'); }); $app->post('/card/update', function () use($app) { $data = $app->request()->post('card'); $card = new models\Card(); $card->update($data); $app->redirect('/cards'); }); $app->get('/card/:id/destroy', function ($id) use($app) { $card = new models\Card(); $card->destroy($id); $app->redirect('/cards'); }); $app->get('/card/:id/edit', function ($id) use($app) { $card = new models\Card(); $res = $card->getCardById($id); $card = $res[0]; if ($card) { $card['checked'] = ''; if ($card['status'] == 1) { $card['checked'] = 'checked="checked"'; } $app->render('cards/edit.html', array('card' => $card, 'id' => $id, 'active_cards' => 'active')); } else { $app->notFound(); }