public function deleteBulk(Request $req, QuranNote $note) { // if the table_records is empty we redirect to the subject index if (!$req->has('table_records')) { return redirect()->route('n.quran.index'); } // we get all the ids and put them in a variable $ids = $req->input('table_records'); // we delete all the subject with the ids $ids $note->destroy($ids); // we redirect to the user index view with a success message return redirect()->route('n.quran.index')->with('success'); }
/** * Show the form for creating a new resource. * @return Response */ public function show($rec_id) { $recordings = QuranRecording::with('student', 'subject', 'evaluator', 'student.registration', 'student.registration.files')->findOrFail($rec_id); // dd($recordings); $elements = EvaluationElement::where('state', 'نشط')->where('quran_id', $recordings->subject_id)->get(); $notes = QuranNote::pluck('content', 'content')->toArray(); $notes_grad = QuranNote::orderBy('grade_to')->pluck('content', 'grade_to')->toArray(); $video = $recordings->quran_video; $student_id = $recordings->student->id; // $photo = $recordings->student->photo->first(); // dd($recordings->student->registration); if ($recordings->student->registration->file) { $photo = $recordings->student->registration->files->first(function ($key, $file) { return $file->type == 'transcript'; })->file->url('medium'); } else { $photo = 'لا يوجد صورة'; } // return asset($photo); $page = $recordings->page; return view('quran::quran.show', compact('recordings', 'video', 'page', 'elements', 'notes', 'rec_id', 'student_id', 'photo', 'notes_grad')); }