public function getIndex($user) { if ($user->id != Auth::user()->id) { returnresponse('Unauthorized.', 401); } if ($user->profile) { $input = $user->profile->toArray(); } else { $input = []; } $input['gender'] = $user->gender; $split = explode('-', $user->birth_date); $input['birth_date'] = $split[2] . '.' . $split[1] . '.' . $split[0]; Session::flash("_old_input", $input); return view('dashboard.profile.edit')->withUser($user); }
/** * Show the form for editing the specified resource. * * @param $user * @return Response */ public function edit($user) { if ($user->id != Auth::user()->id) { returnresponse('Unauthorized.', 401); } Session::flash("_old_input", $user->profile); return view('profile.update'); }