public function edit($id) { try { $student = Student::findOrFail($id); } catch (Exception $e) { App::abort(404); } $interestsTable = Interest::all(); $studentInterests = (string) $student->interests; $studentData = array('student' => $student, 'interestsTable' => $interestsTable, 'studentInterests' => $studentInterests); //dd($strInterests); return view('students.edit', $studentData); }
/** * Display a listing of the resource. * * @return Response */ public function checkprofile() { $mecanex_user = Auth::user()->mecanex_user; $terms = Term::all(); $interests = Interest::all(); $listterms = []; $listscores = []; foreach ($interests as $interest) { array_push($listterms, $interest->interest); } foreach ($terms as $term) { $temp_user = $mecanex_user->profilescore->find($term->id); $user_term_score = $temp_user->pivot->profile_score; array_push($listscores, $user_term_score); } $userprofile = array_combine($listterms, $listscores); return view('user.checkprofile', compact('userprofile')); }
/** * Create a new user using register page. * */ public function createRegister() { $countries = Country::all(); $interests = Interest::all(); return view('index', compact('countries', 'interests')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { //authorization if (!$this->adminAuth() && !$this->userAuth(Auth::User()->id)) { return view('errors.404'); } $interests = Interest::all(); $countries = Country::all(); $user = Generalinfo::where('user_id', $id)->get(); $userinterest = UserInterest::where('user_id', $id)->get()->toArray(); $userinterest = array_pluck($userinterest, 'interest_id'); $this->data['userinterest'] = $userinterest; // $data['userinterest']= $userinterest return view('generalinfos.edit', compact('user', 'interests', 'countries'), $this->data); }
/** * Display a listing of the resource. * * @return Response */ public function index() { // $interests = Interest::all(); return view('interests.index', compact('interests')); }
/** * Store a newly created resource in storage. * * @return Response */ public function store(Request $request) { $mecanex_user = Auth::user()->mecanex_user; //get the input $arts = $request->arts; $disasters = $request->disasters; $education = $request->education; $environment = $request->environment; $health = $request->health; $lifestyle = $request->lifestyle; $media = $request->media; $holidays = $request->holidays; $politics = $request->politics; $religion = $request->religion; $society = $request->society; $transportation = $request->transportation; $wars = $request->wars; $work = $request->work; $mecanex_user->interest()->sync([1 => ['interest_score' => $arts], 2 => ['interest_score' => $disasters], 3 => ['interest_score' => $education], 4 => ['interest_score' => $environment], 5 => ['interest_score' => $health], 6 => ['interest_score' => $lifestyle], 7 => ['interest_score' => $media], 8 => ['interest_score' => $holidays], 9 => ['interest_score' => $politics], 10 => ['interest_score' => $religion], 11 => ['interest_score' => $society], 12 => ['interest_score' => $transportation], 13 => ['interest_score' => $wars], 14 => ['interest_score' => $work]]); //initialize user profile - update table users_terms_scores //for every interest sort_name find the id of the profile terms $interests = Interest::all(); $user_interests = $mecanex_user->interest; $term_ids = []; foreach ($user_interests as $user_interest) { $short_name = $user_interest->short_name; array_push($term_ids, $user_interest->id); $term = Term::where('term', $short_name)->firstOrFail(); $mecanex_user->term()->sync([$term->id => ['user_score' => $user_interest->pivot->interest_score / 5]], false); //normalization } $terms = Term::all()->count(); for ($i = 0; $i <= $terms - 1; $i++) { for ($j = $i + 1; $j <= $terms - 1; $j++) { $temp_user_matrix = MecanexUserTermHomeTermNeighbour::where('mecanex_user_id', $mecanex_user->id)->where('term_home_id', $term_ids[$i])->where('term_neighbor_id', $term_ids[$j])->get()->first(); $temp_user = $mecanex_user->term->find($term_ids[$i]); $user_term_score_a = $temp_user->pivot->user_score; $temp_user = $mecanex_user->term->find($term_ids[$j]); $user_term_score_b = $temp_user->pivot->user_score; $new_score = $user_term_score_a * $user_term_score_b; $temp_user_matrix->link_score = $new_score; $temp_user_matrix->save(); } } for ($j = 1; $j <= $terms; $j++) { $profile_score = 0; for ($i = 1; $i <= $terms; $i++) { $temp_user = $mecanex_user->term->find($i); $user_term_score = $temp_user->pivot->user_score; //get score of user if ($i == $j) { $link_score = 0; } elseif ($i > $j) { $temp_user_matrix = MecanexUserTermHomeTermNeighbour::where('mecanex_user_id', $mecanex_user->id)->where('term_home_id', $j)->where('term_neighbor_id', $i)->get()->first(); $link_score = $temp_user_matrix->link_score; } else { $temp_user_matrix = MecanexUserTermHomeTermNeighbour::where('mecanex_user_id', $mecanex_user->id)->where('term_home_id', $i)->where('term_neighbor_id', $j)->get()->first(); $link_score = $temp_user_matrix->link_score; } $profile_score = $profile_score + $user_term_score * $link_score; } $mecanex_user->profilescore()->sync([$j => ['profile_score' => $profile_score]], false); } return Redirect::route('interest.edit'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $data = Interest::all(); return view('account.interest.index', compact('data')); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { //authorization if (!$this->adminAuth() && !$this->userAuth(Auth::User()->id)) { return view('errors.404'); } $interests = Interest::all(); $countries = Country::all(); $user = Generalinfo::where('user_id', $id)->get(); $userinterest = UserInterest::where('user_id', $id)->get(); return view('generalinfos.edit', compact('user', 'interests', 'countries', 'userinterest')); }
/** * Show the form for editing the specified Prospects. * @param int $id * @return Response */ public function edit($id) { $prospects = $this->prospectsRepository->find($id); if (empty($prospects)) { Flash::error('Prospects not found'); return redirect(route('prospects.index')); } $users = \DB::table('users')->lists('email', 'id'); $gyms = \DB::table('gyms')->lists('nomefantasia', 'id'); $cities = \DB::table('cities')->lists('city', 'id'); $states = \DB::table('states')->lists('state', 'id'); $countries = \DB::table('countries')->lists('country', 'id'); $hearabouts = \DB::table('hearabouts')->lists('hearabout', 'id'); $visittypes = \DB::table('visittypes')->lists('type', 'id'); $contactstatus = \DB::table('contactstatus')->lists('status', 'id'); $contactsteps = \DB::table('contactsteps')->lists('step', 'id'); $consultores = \DB::table('users')->lists('email', 'id'); $maritalstats = \DB::table('maritalstats')->lists('stat', 'id'); $interests = \App\Interest::all(); $interestb = \DB::table('interest_prospect')->where('prospect_id', $id)->get(['interest_id']); return view('prospects.edit')->with('prospects', $prospects)->with('users', $users)->with('gyms', $gyms)->with('cities', $cities)->with('states', $states)->with('countries', $countries)->with('hearabouts', $hearabouts)->with('visittypes', $visittypes)->with('contactstatus', $contactstatus)->with('contactsteps', $contactsteps)->with('consultores', $consultores)->with('maritalstats', $maritalstats)->with('interests', $interests)->with('interestb', $interestb); }