/** * @param null $path * @param array $params * @param string $subdomain * @return mixed */ public function path($path = null, $params = [], $subdomain = '') { if (!is_null($path)) { return $this->app->get('routing')->getCollection()->getRoutePath($path, $params, $subdomain); } return $this->app->get('request')->root(); }
/** * @return mixed */ public static function getInstance() { if (is_null(self::$instance)) { self::$instance = App::getInstance()->get('request'); } return self::$instance; }
/** * @return mixed */ public static function getInstance() { if (is_null(self::$instance)) { self::$instance = App::getInstance()->get('response')->getRedirect(); } return self::$instance; }
/** * @return mixed */ public static function getInstance() { if (is_null(self::$instance)) { self::$instance = App::getInstance()->get('session')->getSession(); } return self::$instance; }
/** * @param null $driver * @return mixed */ public static function getInstance($driver = null) { if (is_null(self::$instance)) { self::$instance = is_null($driver) ? App::getInstance()->get('cache')->getCache() : App::getInstance()->get('cache')->getCache($driver); } return self::$instance; }
/** * @return mixed */ public static function getInstance() { if (is_null(self::$instance)) { self::$instance = App::getInstance()->get('mail')->getMailer(); } return self::$instance; }
function is_token($time, $name = '', $referer = null) { $app = App::getInstance(); $session = $app->get('session')->getSession(); $request = $app->get('request'); if ($session->has($name . '_token_') && $request->getPost()->get($name . '_token') != '') { if ($session->get($name . '_token_/key') == $request->getPost()->get($name . '_token')) { if ($session->get($name . '_token_/time') >= time() - $time) { $session->remove($name . '_token_'); if (is_null($referer)) { return true; } else { if (!is_null($referer) && $request->referer() == ROOT . $referer) { return true; } } } } } $session->remove($name . '_token_'); $session->getFlashBag()->set('response', ['status' => 'error', 'message' => 'token invalid !']); return false; }
/** * @param $name */ public static function destroy($name) { App::getInstance()->get('routing')->getResponse()->headers->clearCookie($name); }
/** * @return Response */ public function response() { return $this->app->get('routing')->getResponse(); }