$parsedObject = $extractor->parseEditData($_POST); $view_controller->updateData($_GET['repcode'], $_GET['id'], $parsedObject); break; } elseif (isset($_POST['sqlState']) && ($_POST['sqlState'] == 'OWN' && $locRights['view'])) { $extObject = $extractor->reloadData($_POST); $view_controller->reDirect($_GET, $_POST, $extObject); break; } else { $view_controller->reDirect($_GET, $_POST); break; } case 'leave': switch ($_GET['leavecode']) { case 'Leave': if (isset($_GET['action'])) { $leaveController = new LeaveController(); $leaveExtractor = new EXTRACTOR_Leave(); $leaveRequestsExtractor = new EXTRACTOR_LeaveRequests(); $leaveTakenExtractor = new EXTRACTOR_LeaveTakenRequests(); $LeaveTypeExtractor = new EXTRACTOR_LeaveType(); $leaveQuotaExtractor = new EXTRACTOR_LeaveQuota(); $holidaysExtractor = new EXTRACTOR_Holidays(); $weekendsExtractor = new EXTRACTOR_Weekends(); switch ($_GET['action']) { case 'Leave_HomeSupervisor': $leaveController->setId($_SESSION['empID']); $leaveController->gotoLeaveHomeSupervisor(); break; case 'Leave_FetchLeaveEmployee': $leaveController->setId($_SESSION['empID']); $leaveController->viewLeaves();
<?php use Klein\Klein as Route; $bag = new Pimple\Container(); // container $route = new Route(); $home = new Home($bag); //controller $dashboard = new Dashboard($bag); // controller $user = new User(); $role = new Role(); $leave = new LeaveController($bag); // $route->respond( function () use($home){ // return 'Middleware should be first palce'; // }); $route->respond('GET', '/', function () use($home) { return $home->index(); }); $route->respond('GET', '/test', function () use($user, $role) { $users = $user->all(); foreach ($users as $user) { var_dump($user->role->permission); } }); $route->respond('GET', '/show/[i:id]', function ($request) use($home) { return $home->show($request); }); $route->respond('GET', '/create', function () use($home) { return $home->create(); });