lundi 6 février 2017

Calling function from the same controller to return the view with flash message

When the user save the object in the blade view, a function into my controller execute with post request. If the save was success I want to reload the page with the changes.

So I need to call index() again to get the refreshed data. Also, I want to show a success message. So the steps are:

  1. index() function execute so the user can show his items.
  2. the user choose an item and save it
  3. save(Request $request) is called
  4. everything save fine
  5. save function call index() with sending a parameter with the flash success message?

I have this structure in my controller:

public function index(){
   ...
   return view('agenda')->with(['agenda'=>$response]);
}

public function save(Request $request){
   ...
   // here where I need to return index function with success message
}

How can I solve my problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2kLVWFw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire