Skip to content

Instantly share code, notes, and snippets.

@Mombuyish
Created February 23, 2020 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mombuyish/d761da57934d3d2e17a830edf9622fe7 to your computer and use it in GitHub Desktop.
Save Mombuyish/d761da57934d3d2e17a830edf9622fe7 to your computer and use it in GitHub Desktop.
<?php
// Illuminate\Foundation\Application
public function configurationIsCached()
{
return file_exists($this->getCachedConfigPath());
}
public function getCachedConfigPath()
{
return $this->normalizeCachePath('APP_CONFIG_CACHE', 'cache/config.php');
}
protected function normalizeCachePath($key, $default)
{
if (is_null($env = Env::get($key))) {
return $this->bootstrapPath($default);
}
return Str::startsWith($env, '/')
? $env
: $this->basePath($env);
}
// Deal with your bootstrap path
public function bootstrapPath($path = '')
{
return $this->basePath.DIRECTORY_SEPARATOR.'bootstrap'.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
// Deal with your base path
public function basePath($path = '')
{
return $this->basePath.($path ? DIRECTORY_SEPARATOR.$path : $path);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment