return Redirect::action('UserController@editUser')->withErrors($validator->errors()); // THIS BUGGED
Does this need you to pass the ID parameter like so:
return Redirect::action('UserController@editUser' , array('id'=>Auth::id()) )->withErrors($validator->errors());
Thanks, i will try it out. But can i pass not my current ID, but the id of user which i am looking for. In my case it's 1. With Auth::id() i am getting my current id.
Ahh of course yes, pass the id of the post owner :)
Thanks, but why do i have to do that? I have other method in same controller, but it works without sending any variables:
public function editMyProfile() {
$user = $this->user->find(Auth::id());
return View::make('auth.editUser')->with('user', $user);
}
public function doEditMyProfile() {
// Validation
$validator = new UserEditFormValidator(Input::all());
if ($validator->fails()) {
return Redirect::action('UserController@editMyProfile')->withErrors($validator->errors());
}
$input = array(
'id' => Input::get('id'),
'name' => Input::get('name'),
'active' => (Input::has('active')) ? true : false,
'password' => Input::get('password')
);
$this->user->update($input);
return Redirect::action('UserController@editMyProfile')->with('success', 'Your profile data has been updated');
}
I have noticed, when i submit form via POST it redirect me to url:
users/{id}/edit
instead of:
users/1/edit
So i need to send variable with Redirect class only in case of using get variables?
I beleive its because your method editUser requires the parameter $id
public function editUser($id) {
$user = $this->user->find($id);
return View::make('auth.editUser')->with('user', $user);
}
Where as editMyProfile doesn't
public function editMyProfile() {
$user = $this->user->find(Auth::id());
return View::make('auth.editUser')->with('user', $user);
}
At least that'd be my assumptions
Hope that helps
heihachi88 said:
Thanks, i will try it out. But can i pass not my current ID, but the id of user which i am looking for. In my case it's 1. With Auth::id() i am getting my current id.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community