Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Place AssetsHelper.php file to the directory you wish, favourably inside app/Helpers.
- // Then reference it from the composer.json.
- if (!function_exists('public_path')) {
- /**
- * Get the path to the public folder.
- *
- * @param string $path
- *
- * @return string
- */
- function public_path($path = '')
- {
- return __DIR__ . '/../../public' . ($path ? DIRECTORY_SEPARATOR . $path : $path);
- }
- }
- if (!function_exists('elixir')) {
- /**
- * Get the path to a versioned Elixir file.
- *
- * @param string $file
- * @param string $buildDirectory
- *
- * @return string
- *
- * @throws \InvalidArgumentException
- */
- function elixir($file, $buildDirectory = 'build')
- {
- static $manifest;
- static $manifestPath;
- if (is_null($manifest) || $manifestPath !== $buildDirectory) {
- $manifest = json_decode(file_get_contents(public_path($buildDirectory . '/rev-manifest.json')), true);
- $manifestPath = $buildDirectory;
- }
- if (isset($manifest[$file])) {
- return '/' . $buildDirectory . '/' . $manifest[$file];
- }
- throw new InvalidArgumentException("File {$file} not defined in asset manifest.");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement