예제 #1
0
<?php

$app->group('/dashboard', function () use($app) {
    $app->group('/admin', function () use($app) {
        /***********************************************************START Add/Create*********************************/
        $app->get('/create', function () use($app) {
            $app->view->setData('currencies', L::getAllCurrency());
            $app->view->setData('form_action', "dashboard/admin/confirm");
            $app->view->setData('page_title', "Create admin");
            $app->render(new u('admin.create'));
        });
        $app->post('/confirm', function () use($app) {
            $POST = $app->request()->post();
            $admin = new admin();
            $admin->form_post_value = $POST;
            $admin->save();
            if ($admin->fails()) {
                $app->view->setData('error', "1");
                $app->view->setData('msg', $admin->getError());
                $app->render(new u('msg'));
            } else {
                $app->view->setData('success', "1");
                $app->view->setData('msg', "Successfully User Created");
                $app->render(new u('msg'));
            }
        });
        /*****************************************VIEW************************************************/
        $app->get('/view(/:page)', function ($page = 0) use($app) {
            $getAdminList = new admin();
            $cols = $getAdminList->getAdminList();
            $app->view->setData('form_action', "/dashboard/admin/search");