/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $snippet = Snippet::where('id', $id)->orWhere('slug', $id)->firstOrFail(); //fetch all data associated with the snippet $data = Data::where('snippetId', $snippet->id)->accepted()->get(); return view('snippets.show', compact('snippet', 'data')); }
/** * Display the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function show($id) { $course = Course::where('id', $id)->orWhere('slug', $id)->firstOrFail(); $data = Data::where('courseId', $course->id)->where('extension', '!=', 'mp4')->accepted()->get(); $videos = Data::where('courseId', $course->id)->Where('extension', 'mp4')->accepted()->get(); $comments = Comment::where('courseId', $course->id)->get(); return view('courses.show', compact('course', 'comments', 'data', 'videos')); }
public function update($session, array $data) { $data = Data::where('session', '=', $session)->first(); if (empty($data)) { return false; } $data->update($data); return false; }
public function getRecords($fechaini, $fechafin, $fechap) { $referencia = Data::where($fechap, '>=', $fechaini)->where($fechap, '<=', $fechafin)->get()->take(2); if (count($referencia) == 0) { return false; } else { return $referencia; } }