Пример #1
0
 /**
  * @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();
 }
Пример #2
0
 /**
  * @return mixed
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = App::getInstance()->get('request');
     }
     return self::$instance;
 }
Пример #3
0
 /**
  * @return mixed
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = App::getInstance()->get('response')->getRedirect();
     }
     return self::$instance;
 }
Пример #4
0
 /**
  * @return mixed
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = App::getInstance()->get('session')->getSession();
     }
     return self::$instance;
 }
Пример #5
0
 /**
  * @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;
 }
Пример #6
0
 /**
  * @return mixed
  */
 public static function getInstance()
 {
     if (is_null(self::$instance)) {
         self::$instance = App::getInstance()->get('mail')->getMailer();
     }
     return self::$instance;
 }
Пример #7
0
 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;
 }
Пример #8
0
 /**
  * @param $name
  */
 public static function destroy($name)
 {
     App::getInstance()->get('routing')->getResponse()->headers->clearCookie($name);
 }
Пример #9
0
 /**
  * @return Response
  */
 public function response()
 {
     return $this->app->get('routing')->getResponse();
 }