/** * Protected constructor to prevent creating a new instance of the * *Services* via the `new` operator from outside of this class. */ protected function __construct() { parent::__construct(); $this->config = new Config(); $this->input = new Input($this->config->get('config')); $this->output = new Output($this->config->get('mimes')); $router = new Router($this->config->get('routes')); $this->route = $router->route($this->input->uri()); }
public function updateOrCreateDistance($args) { $id_jalan = $args['id_jalan']; $road = $this->jalan->find($id_jalan); if (count($road) > 0) { // jika ketemu, update $this->jalan->update($id_jalan, ['jarak' => Input::get('distance'), 'start' => Input::get('start'), 'finish' => Input::get('finish')]); } else { // jika tidak, insert $this->road->create(['id_pengguna' => 1, 'start' => Input::get('start'), 'finish' => Input::get('finish')]); } }
public function showRemove() { if (!($feed = $this->getFeed())) { return View::handleError('Unable to located feed.'); } $title = 'Remove Feed'; $feeds = $this->getFeeds(); if (Input::method() === 'POST') { $query = $this->app->db->query('DELETE FROM feeds WHERE id = :id'); $query->bind(':id', $feed->id); if ($query->execute()) { Cookie::set('status', 'danger'); Cookie::set('message', 'Feed removed!'); return View::redirect('/'); } } return View::make('feed.remove')->with(compact('title', 'feeds', 'feed'))->render(); }
public function postLogin($args) { $username = Input::get('username'); $password = Input::get('password'); $this->validate(Input::all(), ['username' => 'required']); try { $user = new User(); $user = $user->find(['username', '=', $username]); // dd($user); if (count($user) === 1) { if (Hash::check($password, $user->password)) { Session::put(Config::get('session.name'), $user); return is_ajax() ? http_request() : Redirect::to('/'); } } } catch (\Exception $e) { throw $e; } return Redirect::back(); }
protected function getFeed($id = null) { $id or $id = Input::get('id'); return $this->app->db->query('SELECT * FROM feeds WHERE id = :id')->bind(':id', $id)->getSingle(); }
public function run($controller, $action, $route_params) { $this->setToBeCalledMiddlewares($controller->getRegisteredMiddleware(), $action); $params = ['controller' => $controller, 'action' => $action, 'route_params' => $route_params, 'input' => Input::all()]; return $this->next($params); }