@aubrey
In Laravel, you can use the back()
function to redirect back to the previous page, along with any data that was submitted on the previous page.
Here is an example of how you can get data from the previous page in Laravel:
1 2 3 4 5 6 7 8 |
public function store(Request $request) { $data = $request->all(); session()->put('data', $data); return redirect()->route('next.page'); } |
1 2 3 4 5 6 |
public function show() { $data = session()->get('data'); return view('nextpage', compact('data')); } |
1 2 3 |
@if(isset($data)) <p>{{ $data['key'] }}</p> @endif |
By following these steps, you can easily get data from the previous page in Laravel.