/**
  * Affiche les competences en selectionnant celle de l'etudiant
  *
  * @return View
  */
 public function getCompetence()
 {
     $array['competences'] = Competence::all();
     $etudiant_competence = Auth::user()->user->competences()->get()->toArray();
     $array['etudiant_competence'] = array();
     foreach ($etudiant_competence as $value) {
         array_push($array['etudiant_competence'], $value['nom']);
     }
     return View::make('etudiant.competence')->with($array);
 }
 /**
  * This function changes the language om the competences table in the database.
  * This is done by checking the language from the parameter and then make
  * an update in the table
  * @param type $language
  */
 private function competenceLanguage($language)
 {
     $competences = \App\Competence::all();
     $increment = 0;
     if ($language == 'en') {
         foreach ($competences as $competence) {
             $increment++;
             \App\Competence::where('id', $increment)->update(['name' => trans_choice('localization.competences', $increment)]);
         }
     } elseif ($language == 'sv') {
         foreach ($competences as $competence) {
             $increment++;
             \App\Competence::where('id', $increment)->update(['name' => trans_choice('localization.competences', $increment)]);
         }
     } elseif ($language == 'tr') {
         foreach ($competences as $competence) {
             $increment++;
             \App\Competence::where('id', $increment)->update(['name' => trans_choice('localization.competences', $increment)]);
         }
     }
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $array['offre'] = OffreStage::where('offre_stages.id', $id)->with('competences')->first();
     if (isset($array['offre']->date_debut)) {
         $array['offre']->date_debut = date('Y-m', strtotime($array['offre']->date_debut));
     }
     $array['competences']['mine'] = $array['offre']->competences->lists('id');
     $array['promotions'] = Promotion::all();
     $array['competences']['all'] = Competence::all();
     $array['entreprises'] = Entreprise::all();
     return $array;
 }
 /**
  * Retourne l'ensemble des competences
  */
 public function all()
 {
     return Competence::all();
 }