php - Two forms submit to the same controller update action in Laravel -
i have 2 form updating users table.
each form update different columns , routes following:
route::get('users/preferences', 'auth\authcontroller@pref'); route::get('users/profile/{id}/edit', 'auth\authcontroller@edit'); route::patch('users/profile/{id}', 'auth\authcontroller@update');
both form actions route: users/profile/{id}
is there way can identify form submitted , therefore can apply validate or manipulate data before inserting?
note: not need id in preferences because used current logged in id in case.
public function pref() { return view('pages.users.pref'); } public function edit(user $id) { return view('pages.users.edit')->with('profile', $id); } public function update(request $request, user $id) { // want know of best way know form submitted /* if(this from) else */ return redirect('users/profile/'.$id->userid); }
if have better idea please provide. in advance.
Comments
Post a Comment