/** * Show the form for creating a new resource. * * @return Response */ public function create(Request $request) { $user = new User(); $user->username = $request['username']; $user->email = $request['email']; $user->password = bcrypt($request['password']); $user->ip = $request->ip(); $user->user_typeId = $request['user_typeId']; $user->save(); if ($user->user_typeId == 5) { $org_profile = new Organization_profile(); $org_profile->userId = $user->id; $org_profile->name = $request['name']; $org_profile->address = $request['address']; $org_profile->description = $request['description']; if ($request['brochure']) { $org_profile->brochure = $request['brochure']; } $org_profile->save(); \Session::flash('sucess_message', 'Organization Regestration Completed !'); } else { $user_profile = new User_profile(); $user_profile->userId = $user->id; $user_profile->fname = $request['fname']; $user_profile->mname = $request['mname']; $user_profile->lname = $request['lname']; $user_profile->gender = $request['gender']; $user_profile->save(); \Session::flash('sucess_message', 'User Regestration Completed !'); } return redirect(''); }
public function addCourses(Request $request) { $org_profile = Organization_profile::where('userId', Auth::user()->id)->first(); // $courses = array(); foreach ($request['courses'] as $key => $courseId) { $org_crs = new Organization_course(); $org_crs->organizationId = $org_profile->id; $org_crs->courseId = $courseId; $org_crs->save(); } return $request['courses']; }