public function profile_settings()
{
$student_information = Auth::user()->personal_information;
return view('StudentViews.profile_settings' , compact('student_information'));
}
public function save_profile_information(Request $request)
{
$flag = Auth::user()->personal_information;
if ($flag != "") {
$PersonalInformation = Auth::user()->personal_information;
$PersonalInformation->first_name = $request->first_name;
$PersonalInformation->last_name = $request->last_name;
$PersonalInformation->birthday = $request->birthday;
$PersonalInformation->email = Auth::user()->email;
$PersonalInformation->gender = Auth::user()->gender;
$PersonalInformation->occupation = Auth::user()->occupation;
$PersonalInformation->phone = $request->phone;
$PersonalInformation->website = $request->website;
$PersonalInformation->country = $request->country;
$PersonalInformation->province = $request->province;
$PersonalInformation->city = $request->city;
$PersonalInformation->description = $request->description;
$PersonalInformation->birthplace = $request->birthplace;
$PersonalInformation->marital_status = $request->marital_status;
$PersonalInformation->facebook = $request->facebook;
$PersonalInformation->twitter = $request->twitter;
$PersonalInformation->linkedin = $request->linkedin;
$PersonalInformation->google_plus = $request->google_plus;
$PersonalInformation->save();
$user = Auth::user();
$user->first_name = $request->first_name;
$user->last_name = $request->last_name;
$user->phone = $request->phone;
$user->save();
}
else {
PersonalInformation::create([
'user_id' => Auth::user()->id,
'first_name' => $request->first_name,
'last_name' => $request->last_name,
'birthday' => $request->birthday,
'email' => Auth::user()->email,
'phone' => $request->phone,
'country' => $request->country,
'province' => $request->province,
'city' => $request->city,
'description' => $request->description,
'gender' => Auth::user()->gender,
'occupation' => Auth::user()->occupation,
'website' => $request->website,
'birthplace' => $request->birthplace,
'marital_status' => $request->marital_status,
'facebook' => $request->facebook,
'twitter' => $request->twitter,
'linkedin' => $request->linkedin,
'google_plus' => $request->google_plus,
]);
}
}