The
url
function generates a fully qualified URL to the given path:<?php $url = url('user/profile');
$url = url('user/profile', [1]);
<?php protected function getPasswordFormUrl()
{
return url($this->config['form_url'] ?? route('statamic.protect.password.show'));
}
protected function generateToken()
<?php }
if (Str::startsWith($url, '/')) {
return url($url);
}
return url(config('statamic.cp.route').'/'.$url);
<?php return url($url);
}
return url(config('statamic.cp.route').'/'.$url);
})
->afterSetter(function ($url) {
$cpUrl = url(config('statamic.cp.route')).'/';
<?php return url(config('statamic.cp.route').'/'.$url);
})
->afterSetter(function ($url) {
$cpUrl = url(config('statamic.cp.route')).'/';
if (! $this->active && Str::startsWith($url, $cpUrl)) {
$this->active = str_replace($cpUrl, '', Str::before($url, '?')).'(/(.*)?|$)';
<?php protected function getReferrer()
{
$referrer = url()->previous();
return $referrer === cp_route('unauthorized') ? cp_route('index') : $referrer;
}
<?php protected function authEndpoint()
{
return config('broadcasting.auth_endpoint', url('/broadcasting/auth'));
}
}
<?php ->assertOk()
->assertViewHas('globals', function ($globals) {
return Arr::get($globals, '0.handle', 'test_one')
&& Arr::get($globals, '0.edit_url', url('/cp/globals/test_one'))
&& Arr::get($globals, '1.handle', 'test_three')
&& Arr::get($globals, '1.edit_url', url('/cp/globals/test_three'));
});
<?php return Arr::get($globals, '0.handle', 'test_one')
&& Arr::get($globals, '0.edit_url', url('/cp/globals/test_one'))
&& Arr::get($globals, '1.handle', 'test_three')
&& Arr::get($globals, '1.edit_url', url('/cp/globals/test_three'));
});
}
<?php ->assertOk()
->assertViewHas('globals', function ($globals) {
return Arr::get($globals, '0.handle', 'test_one')
&& Arr::get($globals, '0.edit_url', url('/cp/globals/test_one?site=fr'))
&& Arr::get($globals, '1.handle', 'test_two')
&& Arr::get($globals, '1.edit_url', url('/cp/globals/test_two/edit'));
});
<?php return Arr::get($globals, '0.handle', 'test_one')
&& Arr::get($globals, '0.edit_url', url('/cp/globals/test_one?site=fr'))
&& Arr::get($globals, '1.handle', 'test_two')
&& Arr::get($globals, '1.edit_url', url('/cp/globals/test_two/edit'));
});
}
<?php })
->assertViewHas('globals', function ($globals) {
return Arr::get($globals, '0.handle', 'test_one')
&& Arr::get($globals, '0.edit_url', url('/cp/globals/test_one?site=fr'));
});
}
}
<?php }
$this->assertFalse(auth()->check());
$this->assertEquals(url('/'), $exception->getResponse()->getTargetUrl());
}
<?php }
$this->assertFalse(auth()->check());
$this->assertEquals(url('home'), $exception->getResponse()->getTargetUrl());
}
<?php private function fakeSiteConfig()
{
config(['app.url' => 'http://test.com']);
url()->forceRootUrl(config('app.url'));
Site::setConfig([
'default' => 'en',
'sites' => [