/** * Affiche le profil étudiant * * @return View */ public function getEtudiantProfil() { $array['etudiant'] = Auth::user()->user; $array['promotions'] = Promotion::with('specialites')->get()->toJson(); //Si aucune promotion n'est liée à l'étudiant if (isset($array['etudiant']->promotion_id)) { $array['etudiant_promotion'] = Auth::user()->user->promotion()->first(); } $array['profile'] = ProfileEtudiant::where('etudiant_id', $array['etudiant']->id)->first(); //Si aucune promotion n'est liée à l'étudiant if (isset($array['etudiant_promotion'])) { $array['specialites'] = Promotion::find($array['etudiant']->promotion_id)->specialites()->get(); } $array['etudiant_specialite'] = Auth::user()->user->specialite()->first(); //calculer le pourcentage du profil de l'etudiant $array['pourcentage'] = $this->getPourcentageProfilEtudiant(); return View::make('etudiant.profil')->with($array); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(OffreStageRequest $request, $id, CompetenceRepository $competence) { $offre = OffreStage::find($id); $offre->user_id = Auth::user()->id; $offre->title = Input::get('title'); $offre->promotion_id = Promotion::find(Input::get('promotion'))->id; $offre->specialite_id = Input::get('specialite'); //TODO parse date peut etre en faire un service? $date = Input::get('date_debut'); $offre->date_debut = date('Y-m-d', strtotime($date)); $offre->duree = Input::get('duree'); $offre->description = Input::get('description'); $offre->nom_contact = Input::get('nom_contact'); $offre->email = Input::get('email'); $offre->tel = Input::get('tel'); $offre->horaire = Input::get('horaire'); $offre->adresse_stage = Input::get('adresse_stage'); $offre->gratification = Input::get('gratification'); $offre->save(); $competence->saveMultipe(Input::get('competence'), $offre); return $offre; }