Skip to content

Instantly share code, notes, and snippets.

@wakasann
Created January 7, 2019 11:06
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 wakasann/311a88dca2b1fe571f0ad6f9bc60e53b to your computer and use it in GitHub Desktop.
Save wakasann/311a88dca2b1fe571f0ad6f9bc60e53b to your computer and use it in GitHub Desktop.
try run laravel admin ^1.6 in subfolder
<?php
// var_dump(function_exists('admin_url'));
if (!function_exists('admin_url')) {
/**
* Get admin url.
*
* @param string $path
* @param mixed $parameters
* @param bool $secure
*
* @return string
*/
function admin_url($path = '', $parameters = [], $secure = null)
{
if (\Illuminate\Support\Facades\URL::isValidUrl($path)) {
return $path;
}
$secure = $secure ?: (config('admin.https') || config('admin.secure'));
return url(custom_admin_base_path($path), $parameters, $secure);
}
}
if (!function_exists('custom_admin_base_path')) {
/**
* Get admin url.
*
* @param string $path
*
* @return string
*/
function custom_admin_base_path($path = '')
{
$prefix = '/'.trim(config('admin.url_prefix')).trim(config('admin.route.prefix'), '/');
$prefix = ($prefix == '/') ? '' : $prefix;
return $prefix.'/'.trim($path, '/');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment