Closes #1. Incidents output per-date

This commit is contained in:
James Brooks 2014-11-16 23:24:30 +00:00
parent fab38a766d
commit f86b4000c8
2 changed files with 3 additions and 2 deletions

View File

@ -17,7 +17,7 @@ class CreateIncidentsTable extends Migration {
$table->increments('id');
$table->tinyInteger('component')->default(1);
$table->string('name');
$table->tinyInteger('status', 1);
$table->tinyInteger('status', 1)->default(1);
$table->longText('message');
$table->timestamps();
$table->softDeletes();

View File

@ -1,6 +1,6 @@
<?php
$incidentDate = Carbon::now()->subDays($i);
$incidents = Incident::where('created_at', $incidentDate)->get()
$incidents = Incident::whereRaw('DATE(created_at) = "' . $incidentDate->format('Y-m-d') . '"')->get();
?>
<li>
<h1>{{ $incidentDate->format('jS M, Y') }}</h1>
@ -11,6 +11,7 @@
@foreach($incidents as $incident)
<li>
<h2>{{ $incident->name }}</h2>
<h3><time>{{ $incident->created_at->format('H:i:s A') }}</time></h3>
<p>{{ $incident->message }}</p>
</li>
@endforeach