Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function profileUpdate($studentAem, Request $request)
- {
- $student = Student::aem($studentAem)->first();
- if ($student == null)
- abort('404', 'studentProfileUpdateNotFoundException');
- $student->firstname = $request["firstname"];
- $student->lastname = $request["lastname"];
- $student->father_name = $request["father_name"];
- $student->semester = $request["semester"];
- $student->department_id = $request["department"];
- if ($request->file('photo') != null && $request->file('photo')->isValid()) {
- $extension = $request->photo->extension();
- if (in_array($extension, array('jpg', 'jpeg', 'png'))) {
- $student->photo = md5($student->id) . '.' . $extension;
- $request->photo->storeAs('public/studentProfiles', md5($student->id) . '.' . $extension);
- $student->save();
- return view('dashboard.student.profile', compact('student'));
- } else {
- return abort('403', 'studentProfileUpdateIllegalFileExtension');
- }
- } else {
- $student->save();
- return view('dashboard.student.profile', compact('student'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement