本文整理汇总了PHP中AdminHandler::update方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHandler::update方法的具体用法?PHP AdminHandler::update怎么用?PHP AdminHandler::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminHandler
的用法示例。
在下文中一共展示了AdminHandler::update方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Response
if (!authenticate('1', null)) {
return new Response('Unauthorized', 401);
}
$object = array('username' => $request->get('username'), 'password' => $request->get('password'), 'first_name' => $request->get('first_name'), 'last_name' => $request->get('last_name'), 'email' => $request->get('email'), 'role_id' => $request->get('role_id'));
$handler = new AdminHandler();
$result = $handler->add($object);
return new Response($result['message'], $result['status_code']);
});
// Update admin
$app->POST('/admin/{admin_id}', function (Application $app, Request $request, $admin_id) {
if (!authenticate('user', $admin_id)) {
return new Response('Unauthorized', 401);
}
$object = array('admin_id' => $admin_id, 'username' => $request->get('username'), 'first_name' => $request->get('first_name'), 'last_name' => $request->get('last_name'), 'email' => $request->get('email'));
$handler = new AdminHandler();
$result = $handler->update($object);
return new Response($result['message'], $result['status_code']);
});
// Update role
$app->POST('/admin/{admin_id}/role', function (Application $app, Request $request, $admin_id) {
if (!authenticate('1', null)) {
return new Response('Unauthorized', 401);
}
$object = array('admin_id' => $admin_id, 'role_id' => $request->get('role_id'));
$handler = new AdminHandler();
$result = $handler->updateRole($object);
return new Response($result['message'], $result['status_code']);
});
// Update password
$app->POST('/admin/{admin_id}/password', function (Application $app, Request $request, $admin_id) {
if (!authenticate('user', $admin_id)) {