Improve: subscription index filter links keep context without nesting back
This commit is contained in:
@@ -14,6 +14,25 @@
|
||||
$selfWithoutBack .= '?' . \Illuminate\Support\Arr::query($currentQuery);
|
||||
}
|
||||
$back = $selfWithoutBack;
|
||||
|
||||
// 用于构建“保留当前筛选上下文”的站内跳转链接(且不透传 back,避免嵌套/污染)
|
||||
$buildSelfUrl = function (array $overrides = []) use ($currentQuery) {
|
||||
$q = $currentQuery;
|
||||
foreach ($overrides as $k => $v) {
|
||||
if ($v === null) {
|
||||
unset($q[$k]);
|
||||
} else {
|
||||
$q[$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
$url = '/' . ltrim(request()->path(), '/');
|
||||
if (count($q) > 0) {
|
||||
$url .= '?' . \Illuminate\Support\Arr::query($q);
|
||||
}
|
||||
|
||||
return $url;
|
||||
};
|
||||
@endphp
|
||||
<div class="card mb-20">
|
||||
<p class="muted muted-tight">这里是总台视角的订阅目录页,承接“套餐 -> 订阅 -> 平台订单”的收费主链中间层。</p>
|
||||
@@ -139,14 +158,14 @@
|
||||
</td>
|
||||
<td>
|
||||
@if($subscription->merchant)
|
||||
<a class="link" href="/admin/site-subscriptions?merchant_id={{ $subscription->merchant->id }}">{{ $subscription->merchant->name }}</a>
|
||||
<a class="link" href="{{ $buildSelfUrl(['merchant_id' => $subscription->merchant->id, 'page' => null]) }}">{{ $subscription->merchant->name }}</a>
|
||||
@else
|
||||
未关联站点
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if($subscription->plan)
|
||||
<a class="link" href="/admin/site-subscriptions?plan_id={{ $subscription->plan->id }}">{{ $subscription->plan_name ?: $subscription->plan->name }}</a>
|
||||
<a class="link" href="{{ $buildSelfUrl(['plan_id' => $subscription->plan->id, 'page' => null]) }}">{{ $subscription->plan_name ?: $subscription->plan->name }}</a>
|
||||
@else
|
||||
{{ $subscription->plan_name ?: '未设置' }}
|
||||
@endif
|
||||
|
||||
Reference in New Issue
Block a user