public function current() { $count = Host::where("id", "!=", 0)->get()->count(); $backups = Backup::where(DB::raw('YEAR(created_at)'), '=', "2013")->where(DB::raw('MONTH(created_at)'), '=', "01")->where(DB::raw('DAY(created_at)'), '=', "21")->where('type', '=', 'cron')->get(array('id', 'host_id', 'hostname', 'status', 'files_original_size', 'db_original_size', 'total_size')); $report = ""; foreach ($backups as $backup) { $backup["files_original_size"] = $this->ghs($backup["files_original_size"]); $backup["db_original_size"] = $this->ghs($backup["db_original_size"]); $backup["total_size"] = $this->ghs($backup["total_size"]); if ($backup["status"] == "ok") { $row = '<tr class="success">'; } if ($backup["status"] == "broken") { $row = '<tr class="danger">'; } if ($backup["status"] == "removed") { $row = '<tr class="warning">'; } $row .= "<td>" . $backup["id"] . "</td>"; $row .= "<td>" . $backup["host_id"] . "</td>"; $row .= "<td>" . $backup["hostname"] . "</td>"; $row .= "<td>" . $backup["files_original_size"] . "</td>"; $row .= "<td>" . $backup["db_original_size"] . "</td>"; $row .= "<td>" . $backup["total_size"] . "</td>"; $row .= "</tr>"; $report .= $row; } return View::make('reports.daily')->with('report', $report)->with('hosts_count', $count)->with('email', Auth::user()->email); }