示例#1
0
 public function detailsEtudiantByEtudiant()
 {
     if (Request::ajax()) {
         $data = Request::All();
         $stagiaire = [];
         $etudiant = Etudiant::infos($data['idEtudiant']);
         $stagiaire['etudiant'] = $etudiant;
         $stage = Stage::where('idEtudiant', $etudiant->idEtudiant)->select('sujet', 'idTuteur')->first();
         if (count($stage) == 0) {
             $stage = new Stage();
             $tuteur = new Tuteur();
             $entreprise = new Entreprise();
             $entreprise->nom = "-";
             $tuteur->nomTuteur = "-";
             $tuteur->prenomTuteur = "";
             $stage->sujet = "-";
         } else {
             $tuteur = Tuteur::infos($stage->idTuteur);
             if (count($tuteur) == 0) {
                 $tuteur = new Tuteur();
             }
             $entreprise = Entreprise::where('id', $tuteur->idEntreprise)->select('nom')->first();
         }
         $stagiaire['stage'] = $stage;
         $stagiaire['tuteur'] = $tuteur;
         $stagiaire['entreprise'] = $entreprise;
         return $stagiaire;
     } else {
         return "Error.";
     }
 }
 public function dataToCompteRenduVisite()
 {
     $data = [];
     $stage = Stage::where('idEtudiant', session('idEtudiantFocus'))->first();
     $entreprise = [];
     $contact = [];
     if (count($stage) > 0) {
         $tuteur = Tuteur::where('idUtilisateur', $stage->idTuteur)->first();
         if (count($tuteur) > 0) {
             $entreprise = Entreprise::where('id', $tuteur->idEntreprise)->first();
             if (count($entreprise) > 0) {
                 $contact = Contact::where('idEntreprise', $entreprise->id)->where('type', 1)->first();
             }
         }
     }
     if (count($entreprise) == 0) {
         $entreprise = new Entreprise();
     }
     $data['entreprise'] = $entreprise;
     if (count($stage) == 0) {
         $stage = new Stage();
     }
     $data['stage'] = $stage;
     if (count($contact) == 0) {
         $contact = new Contact();
     }
     $data['contact'] = $contact;
     // dd($entreprise);
     return $data;
 }
示例#3
0
 public static function getByID($id)
 {
     return Entreprise::where('id', $id)->first();
 }