/** * Prepare controller */ function __before() { parent::__before(); if ($this->logged_user->isProjectManager() || $this->logged_user->isPeopleManager() || $this->logged_user->isFinancialManager()) { $this->response->assign(array('logged_user' => $this->logged_user)); } else { $this->response->forbidden(); } // if }
/* |-------------------------------------------------------------------------- | Application Routes |-------------------------------------------------------------------------- | | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ /* Sample routes */ Route::get('f**k', function () { return (new ProductionItem())->getUnsoldItems(); return Carbon::now()->addDays(2); return $item = ProductionItem::where('production_id', '=', '215')->where('item_id', '=', '10037')->where('status', '=', "pending")->first()->id; return ReportsController::generateSalesByRange(); return View::make('hello'); return Auth::user()->username; return PDF::loadView('items.barcodes')->setPaper('a6')->setOrientation('landscape')->setWarnings(false)->stream('barcodes.pdf'); }); Route::get('tt', function () { return Session::get('REGISTER'); $item = Item::all(); return PDF::loadView('items.barcodes')->setPaper('a6')->setOrientation('landscape')->setWarnings(false)->stream('barcodes.pdf'); $prod = new ProductionItem(); $pending = $prod->getPendingItems(); $prod_items = $prod->getCurrentProductionsItemId(); // return $pending[0]->remaining; foreach ($pending as $item) { print $item->item_id . " "; if (in_array($item->item_id, $prod_items)) {
/** * Aca tenemos que definir todas las rutas que la aplicación va a aceptar. */ public static function init() { // Esta seria la pagina de incio if ($_SERVER['REQUEST_URI'] == '/electiva_php_ude_2015/') { $controller = new HomeController(); $controller->index(); } else { if (strpos($_SERVER['REQUEST_URI'], 'sessions')) { $controller = new SessionsController(); if (strpos($_SERVER['REQUEST_URI'], 'login') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->modal(); } else { if (strpos($_SERVER['REQUEST_URI'], 'login') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->login(); } else { if (strpos($_SERVER['REQUEST_URI'], 'logout') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->logout(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } else { if (strpos($_SERVER['REQUEST_URI'], 'users')) { $controller = new UsersController(); if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->create(); } else { if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->form(); } else { if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->delete(); } else { if (strpos($_SERVER['REQUEST_URI'], 'modify') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->modify(); } else { if (strpos($_SERVER['REQUEST_URI'], 'update') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->update(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } } } else { if (strpos($_SERVER['REQUEST_URI'], 'polyclinics')) { $controller = new PolyclinicsController(); if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->create(); } else { if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->form(); } else { if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->delete(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } else { if (strpos($_SERVER['REQUEST_URI'], 'reports')) { $controller = new ReportsController(); if (strpos($_SERVER['REQUEST_URI'], 'index') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } else { if (strpos($_SERVER['REQUEST_URI'], 'bookings')) { $controller = new BookingsController(); if (strpos($_SERVER['REQUEST_URI'], 'create') && $_SERVER['REQUEST_METHOD'] == 'POST') { $controller->create(); } else { if (strpos($_SERVER['REQUEST_URI'], 'new') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->form(); } else { if (strpos($_SERVER['REQUEST_URI'], 'delete') && $_SERVER['REQUEST_METHOD'] == 'GET') { $controller->delete(); } else { if ($_SERVER['REQUEST_METHOD'] == 'GET') { $controller->index(); } } } } } else { $controller = new HomeController(); $controller->index(); } } } } } } }