I have a very weird problem that I never came across before.
I have two routes:
Route::get('/users/profile' , 'UserController@profile');
Route::patch('/users/profile/{id}/update' , 'UserController@profile_update');
first one loads the profile view with all the form bindings and second one updates the data and loads the view.
When I visit /users/profile I see form with model binding working because I pass variables for model binding while returning the view.
something like: return view('/users/profile',compact('users','abc','def','ghi','jkl','mno', 'pqr'));
this view has a form which if I change value and press update button I dont see any model binding happen with new values as I am returning this return : return Redirect::to('/users/profile'); because there is not even a single variable passed, model binding fails to occur.
How can I update the data and fall back to /users/profile view and function to load model binding values. Only If I refresh the page /users/profile I see new changes updated to model binding. But how do I see the updated values after I hit the update button?
I want to avoid extra refresh which does the model binding. I guess I am doing something wrong with returning views because if I pass return as redirect('/users/profile') I prefer to load profile function. and If I make any changes then do it in profile_update function but return original view (/users/profile with all the variables to ensure model binding)
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2rv9KIn
via IFTTT
Aucun commentaire:
Enregistrer un commentaire