Ejemplo n.º 1
0
 /**
  * Show the application dashboard to the user.
  *
  * @return Response
  */
 public function index()
 {
     $user_id = \Auth::user()->id;
     $user = User::findOrFail($user_id);
     $kuis = $user->kuis;
     $daftarKelas = Kelas::take(5)->get();
     $daftarMateri = Materi::take(5)->get();
     $daftarKuis = Kuis::take(5)->get();
     return view('home')->with('user', $user)->with('kuis', $kuis)->with('daftarKelas', $daftarKelas)->with('daftarMateri', $daftarMateri)->with('daftarKuis', $daftarKuis);
 }
Ejemplo n.º 2
0
 public function downloadFileMateri($idMateri)
 {
     $materi = Materi::findOrFail($idMateri);
     $materiTitle = $materi->title;
     $fileMateri = $materi->file;
     $pathTofile = public_path() . '/files/' . $fileMateri;
     //get the file location.
     $fileExtension = \File::extension($pathTofile);
     //get the file extension
     if (\File::exists($pathTofile)) {
         return response()->download($pathTofile, $materiTitle . "." . $fileExtension);
     } else {
         return "File tidak terdapat dalam sistem";
     }
 }
Ejemplo n.º 3
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $praktikum = Praktikum::findOrFail($id);
     $opsiMateri = Materi::lists('title', 'id');
     return View('praktikum.edit')->with('praktikum', $praktikum)->with('opsiMateri', $opsiMateri);
 }