Пример #1
0
 public function index(Request $request)
 {
     $subjects = Subject::whereHas('students', function ($query) use($request) {
         return $query->where('students.id', $request->input('student_id'));
     })->get();
     return $subjects;
 }
Пример #2
0
 /**
  * Display a listing of the resource.
  * @return Response
  */
 public function index()
 {
     $subjects = Subject::whereHas('teachers', function ($query) {
         $query->where('teacher_id', teacher()->id);
     })->get();
     return view('teachers::profile.tests.index', compact('subjects'));
 }
Пример #3
0
 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'));
 }
 public function activityedit($id)
 {
     $exam = Exam::findOrFail($id);
     $subjects = Subject::whereHas('teachers', function ($query) {
         $query->where('teacher_id', teacher()->id);
     })->lists('name', 'id')->toArray();
     $types = config('teachers.types');
     $classrooms = Classroom::where('teacher_id', teacher()->id)->inCurrentSemester()->pluck('code', 'id')->toArray();
     return view('teachers::profile.activity.edit', compact('exam', 'types', 'subjects', 'classrooms'));
 }