Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

sreelakshmi's avatar

How to refresh a page in laravel after saving data?

After saving data to database i want to refresh the page. How to do this in laravel controller?

0 likes
7 replies
Keldarne's avatar

You can use a redirect on current path with something like this :

redirect(Request::url())

Not sure it is totally correct but something like this will reload page normally !

sreelakshmi's avatar

I tried the following code.. But not working

public function store() { $validator = Validator::make(Input::all(), array( 'name'=>'required' )); if($validator->passes()){ states::savestate(Input::except(array('_token')));

    }   
    return Redirect::back()->with('message','Operation Successful !');

}
1 like
Keldarne's avatar

Sorry I updated my answer, but if it doesn't work you might try to use something like :

return view('/wantedView')
Keldarne's avatar

I don't have any other ideas, I'm new to Laravel too so I'm sorry :D

vipin93's avatar

have u got any errors; here is two option if u want redirect back then use

return back();

and other is that if want another page then use route like

return redirect()->to('/route'); 
6 likes
cipfahim's avatar

Hey Vipin93 Thanks man it work for me :)

1 like

Please or to participate in this conversation.