我在Laravel有一個簡單的發佈表單,它正在重定向到發佈後的同一表單(狀態爲302)。我不確定是否有任何路線問題或其他問題。Laravel 5.4發佈重定向到GET狀態302
我的表格:
{!! Form::open(['route' => 'subscription.store']) !!}
<script
src="https://checkout.stripe.com/checkout.js" class="stripe-button"
data-key="pk_test_xxxxxx"
data-amount="2000"
data-name="Name"
data-description="2 widgets"
data-image="https://stripe.com/img/documentation/checkout/marketplace.png"
data-locale="auto"
data-currency="cad">
</script>
{!! Form::close() !!}
路線: Route::post('/subscription/store', 'Admin\[email protected]')->name('subscription.store')->middleware('can:admin-access');
Cntroller:
public function store(Request $request)
{
$user = User::find($request->user()->id);
$user->newSubscription('main', 'main')->create($request->input('stripeToken'));
if ($user->subscribed('main')) {
return redirect()->route('admin.dashboard');
}
}
Chrome的網絡日誌:
Request Method:POST Status Code:302 Found Remote Address:10.1.1.33:80 Referrer Policy:no-referrer-when-downgrade
任何建議有什麼缺失或錯誤在這裏?