public function deleteBulk(Request $request, QuranPage $pages) { // if the table_records is empty we redirect to the subject index if (!$request->has('table_records')) { return redirect()->route('p.quran.index'); } // we get all the ids and put them in a variable $ids = $request->input('table_records'); // we delete all the subject with the ids $ids $pages->destroy($ids); // we redirect to the user index view with a success message return redirect()->route('p.quran.index')->with('success'); }
public function index($subject_id = 0) { if (!($subject = Subject::whereHas('students', function ($q) { $q->where(['students.id' => student()->id, 'semester_id' => semester()->id]); })->find($subject_id))) { return redirect()->route('students.students.index'); } $student = student(); $page = QuranPage::where('subject_id', $subject_id)->first(); if (!$page) { return redirect()->route('students.profile.subjects.index')->with('warning', 'لا يوجد صفحات قران كريم لهذه المادة'); } return view('students::profile.quran.index', compact('page', 'subject', 'student')); }
/** * Display a listing of the resource. * @return Response */ public function index() { $pages = QuranPage::select('subject_id', 'start', 'end')->get(); return response()->json($pages, 200, [], JSON_NUMERIC_CHECK); }