/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { foreach (Auth::user()->schools()->lists('school_id')->toArray() as $k => $v) { $value = $v; } $attendances = Attendance::all(); $attendanceStudents = $attendances->students->flatten()->toArray(); $attendanceUsers = $attendances->users->flatten()->toArray(); $attendanceGrades = $attendances->grades->flatten()->toArray(); return view('attendance.index', compact('attendanceStudents', 'attendanceUsers', 'attendanceGrades')); }
/** * * *Functions * */ public function initialized() { $dbToday = null; if (!empty(Attendance::all()->toArray())) { $dbToday = Attendance::latest('att_date')->first()->att_date; } return $dbToday->isSameDay(Carbon::now()); }