<button type="submit" name="action" value="back">戻る</button>
<button type="submit" name="action" value="submit">確認</button>
一覧画面への場合
$action = $request->get('action', 'back');
$input = $request->except('action');
if($action == 'back') {
return redirect()->route('post.index');
}
詳細画面への場合
$action = $request->get('action', 'back');
$input = $request->except('action');
if($action == 'back') {
return redirect()->route('post.show', compact('id');
}
コメント