The
url
function generates a fully qualified URL to the given path:<?php $url = url('user/profile');
$url = url('user/profile', [1]);
<?php $usingNavigate = $this->storeGet('redirectUsingNavigate');
if (is_subclass_of($to, Component::class)) {
$to = url()->action($to);
}
if ($to && ! app(HandleRequests::class)->isLivewireRequest()) {
<?php public function assertRedirect($uri = null)
{
if (is_subclass_of($uri, Component::class)) {
$uri = url()->action($uri);
}
if (! app('livewire')->isLivewireRequest()) {
<?php );
if (! is_null($uri)) {
PHPUnit::assertSame(url($uri), url($this->effects['redirect']));
}
return $this;
<?php $component->runAction('triggerRedirectHelper');
$this->assertEquals(url('foo'), $component->effects['redirect']);
}
<?php $component->runAction('triggerRedirectHelperUsingKeyValueWith');
$this->assertEquals(url('foo'), $component->effects['redirect']);
$this->assertEquals('livewire-is-awesome', Session::get('success'));
}
<?php $component->runAction('triggerRedirectHelperUsingArrayWith');
$this->assertEquals(url('foo'), $component->effects['redirect']);
$this->assertEquals('livewire-is-awesome', Session::get('success'));
}
<?php $component->runAction('triggerRedirectFacadeUsingTo');
$this->assertEquals(url('foo'), $component->effects['redirect']);
}
<?php $post = $this
->from('/full-page-component')
->followingRedirects()
->post(url('/non-livewire-form'))
->assertSee('sharedError:The bar field is required');
}
<?php function originalUrl()
{
if ($this->isLivewireRequest()) {
return url()->to($this->originalPath());
}
return url()->current();
<?php return url()->to($this->originalPath());
}
return url()->current();
}
function originalPath()
<?php $versionedFileName = "{$fileName}?id={$versionedFileName}";
$assertUrl = config('livewire.asset_url') ?? url("vendor/livewire{$versionedFileName}");
$url = $assertUrl;
<?php return call_user_func(static::$createUrlCallback, $notifiable, $this->token);
}
return url(route('password.reset', [
'token' => $this->token,
'email' => $notifiable->getEmailForPasswordReset(),
], false));
}
<?php protected function invalid($request, ValidationException $exception)
{
return redirect($exception->redirectTo ?? url()->previous())
->withInput(Arr::except($request->input(), $this->dontFlash))
->withErrors($exception->errors(), $request->input('_error_bag', $exception->errorBag));
}
<?php function secure_url($path, $parameters = [])
{
return url($path, $parameters, true);
}
}
<?php $uri = substr($uri, 1);
}
return trim(url($uri), '/');
}