Get a fresh application instance.

@return \Illuminate\Contracts\Foundation\Application
433530
protected function getFreshApplication()
    {
        return tap(require $this->laravel->bootstrapPath().'/app.php', function ($app) {
            $app->make(ConsoleKernelContract::class)->bootstrap();
        });
    }
175002
public function fresh()
    {
        $model = $this->query->newInstance()->findByDn($this->getDn());

        return $model instanceof Model ? $model : null;
    }
428715
public function create()
    {
        $instance = self::createReturnOperation($this);
        $this->setId($instance->getId());
        return $instance;
    }
1225670
public function getApplication()
    {
        $application = $this->application;

        if ($application instanceof Closure) {
            return $application();
        } elseif (is_string($application)) {
            /** @noinspection PhpIncludeInspection */
            return require $application;
        }

        return $application;
    }
860664
public function getApp(): App
    {
        if (!is_null($this->getTemplateEngine()->getApp())) {
            return $this->getTemplateEngine()->getApp();
        } else {
            throw new RuntimeException('Template engine is not initialized with application');
        }
    }
164127
public function getApplicationUseNow(){
		$tmp=explode('/', preg_replace('/^[\/]*(.*?)[\/]*$/', '\\1', $_SERVER['REQUEST_URI']));


		foreach ($tmp as $key => $value) {
			if(isset($tmp[$key]) && is_array($this->getApplication()) && array_key_exists($tmp[$key],$this->getApplication())){
				for ($i=0; $i < $key; $i++) {
					array_shift($tmp);
				}
				$app_path = $this->getApplication();
				$app_public = $app_path[$tmp[0]]['path_public'];
				$app_path = $app_path[$tmp[0]]['path_app'];
				$this->setNameApplication($tmp[0]);
			}
		}

		for ($i=0; $i < count($key); $i++) {
			array_shift($tmp);
		}

		if(!isset($app_path)){
			$app_path = $this->getApplication();
			$app_public=$app_path['default']['path_public'];
			$app_path=$app_path['default']['path_app'];
			$this->setNameApplication('default');
		}

		$this->setApplicationName($app_path);
		if(!file_exists(PATH_ROOT.$app_public)){
			throw new \Exception("app_public não foi encontrado em: ".PATH_ROOT.$app_public);
		}else{
			$this->setPublicPath($app_public);
		}

	}
650629
public function getPrevious()
    {
        $start = clone $this->begin;
        $start->sub(static::getDateInterval());

        return new static($start, $this->factory);
    }
652917
public function refresh()
    {
        $behaviors = $this->owner->behaviors();
        $settings = $behaviors[$this->getName()];
        foreach ($settings as $attribute=>$value) {
            if (in_array($attribute, array('class'))) {
                continue;
            }
            $this->$attribute = $value;
        }
        return $this;
    }
344489
public static function getInstance()
    {
        if (null === self::$instance) {
            $class          = new \ReflectionClass(__CLASS__);
            self::$instance = $class->newInstanceArgs(func_get_args());
        }

        return self::$instance;
    }
294777
public function newQuery() {
        $factory = $this->factory;
        $factory->setServiceLocator($this->serviceLocator);
        return $factory->get($this->queryClassName)->setParent($this);
    }
3761
public function create()
    {
        $instance = self::createDiscountPromotion($this);
        $this->setId($instance->getId());
        return $instance;
    }
410161
function cacheApplication() {
        $this->log("Downloading application...");
        $app = Config::instance()->application->apiClient()->get("application", array("definition" => "true"));
        $this->cache(Application::cacheKey(), json_encode($app));
        $this->log("Application has been cached.");
        return $app;
    }
207224
public static function instance()
    {
        if (empty(self::$databaseInstance)) {
            self::$databaseInstance = new static(self::$config);
        }
        return self::$databaseInstance;
    }
547293
public static function run()
    {
        if (! isset(self::$instance)) {
            self::$instance = new self();

            self::$instance->setup();
            self::$instance->execute();
            self::$instance->hooks();
            self::$instance->ajax();
        }

        return self::$instance;
    }
621854
public function getApplication(): ?Application
    {
        if ($this instanceof Application) {
            return $this;
        }

        if ($p = $this->parent) {
            return $p->getApplication();
        }

        return null;
    }
857732
public function initialize()
    {
        // Create the application object
        $app = new Application;

        $this->setEnvironment($app);
        $this->registerConfig($app);

        // Handle init config
        $initConfig = $app['config']->load('init');

        if ($initConfig['debug']) {
            Debug::enable();
            $app['debug'] = true;
        }

        return $app;
    }
801125
public static function app()
    {
        if (static::$app instanceof self) {
            return static::$app;
        } else {
            $app = new static(true);
            $app->is_single = true;
            return (static::$app = $app);
        }
    }