Remove get_base_url function

This commit is contained in:
Pig Fang 2019-04-07 08:54:54 +08:00
parent 09b9959bc8
commit 6da5094cb4
2 changed files with 2 additions and 15 deletions

View File

@ -5,24 +5,11 @@ use App\Models\User;
use Illuminate\Support\Arr;
use Illuminate\Support\Str;
if (! function_exists('get_base_url')) {
function get_base_url()
{
$base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_url .= $_SERVER['SERVER_NAME'];
$base_url .= ($_SERVER['SERVER_PORT'] == '80') ? '' : (':'.$_SERVER['SERVER_PORT']);
return $base_url;
}
}
if (! function_exists('webpack_assets')) {
function webpack_assets($relativeUri)
{
if (app()->environment('development')) {
// @codeCoverageIgnoreStart
return "http://127.0.0.1:8080/$relativeUri";
// @codeCoverageIgnoreEnd
return "http://127.0.0.1:8080/$relativeUri"; // @codeCoverageIgnore
} else {
$path = app('webpack')->$relativeUri;
$cdn = option('cdn_address');

View File

@ -28,7 +28,7 @@
{!! get_string_replaced(option('comment_script'), [
'{tid}' => $texture->tid,
'{name}' => $texture->name,
'{url}' => get_base_url().$_SERVER['REQUEST_URI']
'{url}' => request()->url()
]) !!}
</div>
</div>