Created
January 7, 2019 11:06
-
-
Save wakasann/311a88dca2b1fe571f0ad6f9bc60e53b to your computer and use it in GitHub Desktop.
try run laravel admin ^1.6 in subfolder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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