use relative URL for route function (fix #222)

This commit is contained in:
Pig Fang 2020-08-21 23:10:14 +08:00
parent 479e1cbda3
commit d13e1ba2af
No known key found for this signature in database
GPG Key ID: A8198F548DADA9E2
6 changed files with 9 additions and 9 deletions

View File

@ -23,7 +23,7 @@ class UserMenuComposer
public function compose(View $view) public function compose(View $view)
{ {
$user = auth()->user(); $user = auth()->user();
$avatarUrl = route('avatar.texture', ['tid' => $user->avatar, 'size' => 36]); $avatarUrl = route('avatar.texture', ['tid' => $user->avatar, 'size' => 36], false);
$avatar = $this->filter->apply('user_avatar', $avatarUrl, [$user]); $avatar = $this->filter->apply('user_avatar', $avatarUrl, [$user]);
$cli = $this->request->is('admin', 'admin/*'); $cli = $this->request->is('admin', 'admin/*');

View File

@ -25,7 +25,7 @@ class UserPanelComposer
{ {
/** @var User */ /** @var User */
$user = auth()->user(); $user = auth()->user();
$avatarUrl = route('avatar.texture', ['tid' => $user->avatar, 'size' => 45]); $avatarUrl = route('avatar.texture', ['tid' => $user->avatar, 'size' => 45], false);
$avatar = $this->filter->apply('user_avatar', $avatarUrl, [$user]); $avatar = $this->filter->apply('user_avatar', $avatarUrl, [$user]);
$badges = []; $badges = [];

View File

@ -19,7 +19,7 @@
<tr> <tr>
<td> <td>
{{ report.tid }}&nbsp; {{ report.tid }}&nbsp;
<a href="{{ route('skinlib.show', {texture: report.tid}) }}" target="_blank"> <a href="{{ route('skinlib.show', {texture: report.tid}, false) }}" target="_blank">
<i class="fas fa-share"></i> <i class="fas fa-share"></i>
</a> </a>
</td> </td>

View File

@ -9,7 +9,7 @@
{{ trans('auth.oauth.authorization.introduction', {name: client.name}) }} {{ trans('auth.oauth.authorization.introduction', {name: client.name}) }}
</p> </p>
<div class="d-flex justify-content-between"> <div class="d-flex justify-content-between">
<form method="post" action="{{ route('passport.authorizations.approve') }}"> <form method="post" action="{{ route('passport.authorizations.approve', {}, false) }}">
{{ csrf_field() }} {{ csrf_field() }}
<input type="hidden" name="state" value="{{ request.state }}"> <input type="hidden" name="state" value="{{ request.state }}">
<input type="hidden" name="client_id" value="{{ client.id }}"> <input type="hidden" name="client_id" value="{{ client.id }}">
@ -18,7 +18,7 @@
</button> </button>
</form> </form>
<form method="post" action="{{ route('passport.authorizations.deny') }}"> <form method="post" action="{{ route('passport.authorizations.deny', {}, false) }}">
{{ csrf_field() }} {{ csrf_field() }}
{{ method_field('DELETE') }} {{ method_field('DELETE') }}
<input type="hidden" name="state" value="{{ request.state }}"> <input type="hidden" name="state" value="{{ request.state }}">

View File

@ -9,8 +9,8 @@ class UserMenuComposerTest extends TestCase
public function testAvatar() public function testAvatar()
{ {
$user = factory(User::class)->create(['avatar' => 5]); $user = factory(User::class)->create(['avatar' => 5]);
$this->actingAs($user)->get('/')->assertSee(url('/avatar/5?size=36')); $this->actingAs($user)->get('/')->assertSee('/avatar/5?size=36');
$this->get('/skinlib')->assertSee(url('/avatar/5?size=36')); $this->get('/skinlib')->assertSee('/avatar/5?size=36');
$this->get('/user')->assertSee(url('/avatar/5?size=36')); $this->get('/user')->assertSee('/avatar/5?size=36');
} }
} }

View File

@ -12,7 +12,7 @@ class UserPanelComposerTest extends TestCase
$user = factory(User::class)->create(); $user = factory(User::class)->create();
$this->actingAs($user); $this->actingAs($user);
$this->get('/user')->assertSee(url('/avatar/0?size=45')); $this->get('/user')->assertSee('/avatar/0?size=45');
} }
public function testBadges() public function testBadges()