Basic output of incidents
This commit is contained in:
@@ -155,6 +155,7 @@ return array(
|
|||||||
'Auth' => 'Illuminate\Support\Facades\Auth',
|
'Auth' => 'Illuminate\Support\Facades\Auth',
|
||||||
'Blade' => 'Illuminate\Support\Facades\Blade',
|
'Blade' => 'Illuminate\Support\Facades\Blade',
|
||||||
'Cache' => 'Illuminate\Support\Facades\Cache',
|
'Cache' => 'Illuminate\Support\Facades\Cache',
|
||||||
|
'Carbon' => 'Carbon\Carbon',
|
||||||
'ClassLoader' => 'Illuminate\Support\ClassLoader',
|
'ClassLoader' => 'Illuminate\Support\ClassLoader',
|
||||||
'Config' => 'Illuminate\Support\Facades\Config',
|
'Config' => 'Illuminate\Support\Facades\Config',
|
||||||
'Controller' => 'Illuminate\Routing\Controller',
|
'Controller' => 'Illuminate\Routing\Controller',
|
||||||
|
|||||||
@@ -1,23 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class HomeController extends BaseController {
|
class HomeController extends BaseController {
|
||||||
|
public function showIndex() {
|
||||||
/*
|
return View::make('index');
|
||||||
|--------------------------------------------------------------------------
|
}
|
||||||
| Default Home Controller
|
|
||||||
|--------------------------------------------------------------------------
|
|
||||||
|
|
|
||||||
| You may wish to use controllers instead of, or in addition to, Closure
|
|
||||||
| based routes. That's great! Here is an example controller method to
|
|
||||||
| get you started. To route to this controller, just add the route:
|
|
||||||
|
|
|
||||||
| Route::get('/', 'HomeController@showWelcome');
|
|
||||||
|
|
|
||||||
*/
|
|
||||||
|
|
||||||
public function showWelcome()
|
|
||||||
{
|
|
||||||
return View::make('hello');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
Route::get('/', function() {
|
Route::get('/', 'HomeController@showIndex');
|
||||||
return View::make('hello');
|
|
||||||
});
|
|
||||||
|
|||||||
19
app/views/incident.blade.php
Normal file
19
app/views/incident.blade.php
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
$incidentDate = Carbon::now()->subDays($i);
|
||||||
|
$incidents = Incident::where('created_at', $incidentDate)->get()
|
||||||
|
?>
|
||||||
|
<li>
|
||||||
|
<h1>{{ $incidentDate->format('jS M, Y') }}</h1>
|
||||||
|
<ul>
|
||||||
|
@if($incidents->count() === 0)
|
||||||
|
<li>No incidents reported.</li>
|
||||||
|
@else
|
||||||
|
@foreach($incidents as $incident)
|
||||||
|
<li>
|
||||||
|
<h2>{{ $incident->name }}</h2>
|
||||||
|
<p>{{ $incident->message }}</p>
|
||||||
|
</li>
|
||||||
|
@endforeach
|
||||||
|
@endif
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
9
app/views/index.blade.php
Normal file
9
app/views/index.blade.php
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
@extends('layout.master')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
<ul>
|
||||||
|
@for ($i=0; $i <= 7; $i++)
|
||||||
|
@include('incident', array('i', $i))
|
||||||
|
@endfor
|
||||||
|
</ul>
|
||||||
|
@stop
|
||||||
10
app/views/layout/master.blade.php
Normal file
10
app/views/layout/master.blade.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Cachet</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
@section('content')
|
||||||
|
@show
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user