<?php $studentquery = DB::select(DB::raw('SELECT COUNT(`dob`) FROM `students` WHERE `created_at` >= CURDATE() - INTERVAL 1 DAY')); $userquery = DB::select(DB::raw('SELECT COUNT(`email`) FROM `users` WHERE `created_at` >= CURDATE() - INTERVAL 1 DAY')); $tutorialquery = DB::select(DB::raw('SELECT COUNT(`id`) FROM `tutorials` WHERE `created_at` >= CURDATE() - INTERVAL 1 DAY')); $assessmentquery = DB::select(DB::raw('SELECT COUNT(`id`) FROM `assessments` WHERE `created_at` >= CURDATE() - INTERVAL 1 DAY')); $stresult = objectToArray($studentquery); $usresult = objectToArray($userquery); $turesult = objectToArray($tutorialquery); $asresult = objectToArray($assessmentquery); $todayusercount = $usresult[0]['COUNT(`email`)']; $usercountall = User::all()->count(); $todaystudentcount = $stresult[0]['COUNT(`dob`)']; $studentcountall = Student::all()->count(); $todaytutorialcount = $turesult[0]['COUNT(`id`)']; $tutorialcountall = Tutorials::all()->count(); $todayassessmentcount = $asresult[0]['COUNT(`id`)']; $assessmentcountall = Assessments::all()->count(); ?> <div class="sortable row-fluid"> <a data-rel="tooltip" title="{{ $todayusercount }} new members." class="well span3 top-block" href="#"> <span class="icon32 icon-red icon-user"></span> <div>Total Members</div> <div>{{ $usercountall }}</div> <span class="notification">{{ $todayusercount }}</span> </a> <a data-rel="tooltip" title="{{ $todaystudentcount }} new students." class="well span3 top-block" href="#"> <span class="icon32 icon-blue icon-user"></span> <div>Total Students</div> <div>{{ $studentcountall }} </div>
<tr> <th>#ID</th> <th>Title</th> <th>Subject</th> <th>Grade</th> <th>Created Date</th> <th>Modified Date</th> <th>Created By</th> <th>Status</th> <th>Actions</th> </tr> </thead> <tbody> <?php $tutorial_list = Cache::remember('tutorial_listing_dash' . Sentry::getUser()->id, 20, function () { $tutorials = Tutorials::all(); $out = ''; foreach ($tutorials as $tutorial) { $subject = Subject::find($tutorial->subjectid); $teacher = User::find($tutorial->createdby); $username = Sentry::findUserByLogin($teacher->email); if (Sentry::getUser()->inGroup(Sentry::findGroupByName('admin')) || Sentry::getUser()->id == $tutorial->createdby) { $out .= "<tr>"; $out .= "<td>"; $out .= $tutorial->id; $out .= "</td>"; $out .= "<td>"; $out .= $tutorial->name; $out .= "</td>"; $out .= "<td>"; $out .= $subject->subjectname;
public function tutorials() { return Cache::remember('tutorials_api_list', 60, function () { return Tutorials::all(); }); }