public function movie($id) { $movie = Movie::find($id); $notes = Note::where('movie_id', $movie->_id)->orderBy('note', 'DESC')->get(); $data = ['movie' => $movie, 'notes' => $notes]; return view('movie', $data); }
public function addMdiff($movieA, $movieB) { foreach ($this->users as $user) { $noteA = Note::where("movie_id", $movieA->id)->where("user_id", $user->id)->first(); $noteB = Note::where("movie_id", $movieB->id)->where("user_id", $user->id)->first(); if ($noteA && $noteB) { $diff = $noteA->note - $noteB->note; $data = ["movieA_id" => $noteA->movie_id, "movieB_id" => $noteB->movie_id, "diff" => $diff]; Mdiff::create($data); $this->qtdDiffs++; } } }
public function nota() { $notes = Note::where("movie_id", $this->_id)->get(); $qtd = $notes->count(); if (empty($qtd)) { return 0; } $total = 0; $notes->each(function ($note, $index) use(&$total) { $total += $note->note; }); $media = $total / $qtd; return number_format($media, 1, ',', '.'); }
public function qtdAvaliacoes() { return Note::where("user_id", $this->_id)->count(); }
public function index(Request $request, Note $noteModel) { $notes = $noteModel->where('user_id', $request->user()->id)->with('pad')->get(); return app('twig')->render('notes/index.htm', ['notes' => $notes]); }
public function destroy($id) { $question = $this->model->findOrFail($id); $question->tps()->detach(); //TODO: resynch l'ordre $question->delete(); // Détruit les notes associées à cette question $notes = Note::where('question_id', '=', $id)->get(); foreach ($notes as $note) { $note->delete(); } return true; }
function getNotes($id) { $notes = Note::where('doctor_id', '=', $id)->get(); return $notes; }
protected function filter2($filterValue) { //Pour appeler cette function, filter1 doit être sur TOUS //Pour les TPs, le filter 2 est la sessionScholair $etudiant = Auth::user(); $idEtudiant = $etudiant->id; try { if ($filterValue == 0) { // 0 indique 'Tous' sur filter2 $classes = $etudiant->classes->sortBy("sessionscholaire_id"); //TODO si un prof test et que les filtres sont tous/tous, ca n'affiche rien car le prof n'est pas un étudiant de la classe } else { $classes = $this->filteringClass->where('sessionscholaire_id', '=', $filterValue)->get(); //va chercher les classes pour cette session } $lignes = []; foreach ($classes as $classe) { $validTps = Note::where('etudiant_id', '=', $idEtudiant)->where('classe_id', '=', $classe->id)->select('tp_id')->distinct()->lists('tp_id'); $lignes[$classe->nom] = $classe->tps()->whereIn('tp_id', $validTps)->get()->sortBy('nom'); } } catch (Exception $e) { $lignes = []; } return $lignes; }
/** * test for deleting notes * * @return void */ public function testDelete() { Note::where('subject', 'testNote1.com')->delete(); Note::where('subject', 'testNote2.com')->delete(); }
public function resultats($tp_id, $classe_id) { try { $classe = Classe::findOrFail($classe_id); $tp = $classe->tps()->where("tp_id", '=', $tp_id)->first(); } catch (Exception $e) { throw new Exception("Paramêtres incorrects"); } $etudiants = $classe->etudiants()->orderBy('id')->get(); $questions = $tp->questions()->orderBy('ordre')->get(); $i = 1; foreach ($etudiants as $etudiant) { $resultats[$i]['nom'] = $etudiant->prenom . ' ' . $etudiant->nom; $notes = Note::where('classe_id', '=', $classe->id)->where('tp_id', '=', $tp->id)->where('etudiant_id', '=', $etudiant->id)->orderBy("ordre")->get(); foreach ($notes as $note) { $resultats[$i]['notes'][$note->ordre] = $note; } $i++; } return compact('tp', 'classe', 'etudiants', 'resultats', 'questions'); }
private function getUserRatedMovies() { $this->userRatedMovies = Note::where('user_id', $this->user->_id)->orderBy('movie_title', 'ASC')->get(); }
function search($query) { return Note::where('subject', 'LIKE', '%' . $query . '%')->get(); }