Skip to content

Instantly share code, notes, and snippets.

@fhferreira
Forked from vluzrmos/compat_l5.php
Last active August 29, 2015 14:21
Show Gist options
  • Save fhferreira/68682594b1110de77e6d to your computer and use it in GitHub Desktop.
Save fhferreira/68682594b1110de77e6d to your computer and use it in GitHub Desktop.
<?php
if(!function_exists('config_path')){
/**
* Return the path to config files
* @param null $str
* @return string
*/
function config_path($str=null){
return rtrim(realpath(__DIR__."/config/".$str), "/");
}
}
if(!function_exists('public_path')){
/**
* Return the path to public dir
* @param null $str
* @return string
*/
function public_path($str=null){
return rtrim(realpath(__DIR__."/public/".$str), "/");
}
}
if ( ! function_exists('elixir'))
{
/**
* Get the path to a versioned Elixir file.
*
* @param string $file
* @return string
*/
function elixir($file)
{
static $manifest = null;
if (is_null($manifest))
{
$manifest = json_decode(file_get_contents(public_path().'/build/rev-manifest.json'), true);
}
if (isset($manifest[$file]))
{
return '/build/'.$manifest[$file];
}
throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment