示例#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();
 }