예제 #1
0
 public function show($subject_id)
 {
     $where = ['subject_id' => $subject_id, 'student_id' => student()->id, 'semester_id' => semester()->id];
     if (!($recording = QuranRecording::where($where)->with('subject')->first())) {
         return redirect()->route('students.profile.subjects.index');
     }
     return view('students::profile.quran.show', compact('recording'));
 }
예제 #2
0
 /**
  * Display a listing of the resource.
  * @return Response
  */
 public function index()
 {
     $recordings = QuranRecording::where('student_id', $this->student->id)->with('grade')->where('semester_id', $this->semester->id)->get();
     foreach ($recordings as $recording) {
         $recording->excuse = OrderQuranExcuse::where(['semester_id' => semester()->id, 'student_id' => $recording->student_id, 'subject_id' => $recording->subject_id])->first();
     }
     return response()->json($recordings, 200, [], JSON_NUMERIC_CHECK);
 }
예제 #3
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $where = ['student_id' => student()->id, 'semester_id' => semester()->id, 'subject_id' => $request->subject_id, 'remaining' => 0];
     if (QuranRecording::where($where)->count()) {
         return redirect()->route('students.profile.subjects.index')->with('info', 'لقد استنفذت تسجيلات التلاوة المتاحة لك لهذه المادة.');
     }
     return $next($request);
 }
예제 #4
0
 /**
  * Display a listing of the resource.
  * @return Response
  */
 public function index()
 {
     $user = User::findOrFail(user()->id);
     // dd($user->getPermissions()->find('slug','evaluate_quran.index.quran'));
     $recordings = QuranRecording::inCurrentSemester()->with('grade', 'subject', 'evaluator')->whereHas('student', function ($query) use($user) {
         $query->where('gender', $user->sex);
     })->where('valid', 1)->whereIn('subject_id', $user->quran_subjects->pluck('id')->toArray());
     if ($user->canAll(['evaluators.index.quran', 'notes.index.quran'])) {
         $recordings = QuranRecording::where('valid', 1)->paginate(50);
     } elseif ($user->canAll('notes.index.quran', 'evaluate_quran.index.quran')) {
         $recordings = $recordings->where('user_id', '!=', null)->paginate(50);
     } else {
         $recordings = $recordings->where('user_id', null)->paginate(50);
     }
     // $date = new Date;
     // to show recording after 5 days
     // ->where('created_at','<',(Date::Parse($date->format('Y'))->sub('5 Day')))
     $videos = !empty($recordings->videos) ? unserialize($recordings->videos) : [];
     $id = $recordings->pluck('student_id');
     return view('quran::quran.index', compact('recordings', 'videos', 'id'));
 }