Commit a10b7874 authored by Vytor Calixto's avatar Vytor Calixto 👾

Alterada página inicial para mostrar os eventos

parent a325fd1a
......@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Event;
use App\Http\Requests;
use Illuminate\Http\Request;
......@@ -14,7 +15,7 @@ class HomeController extends Controller
*/
public function __construct()
{
$this->middleware('auth');
// $this->middleware('auth');
}
/**
......@@ -24,6 +25,11 @@ class HomeController extends Controller
*/
public function index()
{
return view('home');
$eventosFuturos = Event::where('date', '>=', date('Y-m-d').' 00:00:00')->get();
$eventosPassados = Event::where('date', '<', date('Y-m-d').' 00:00:00')->get();
return view('welcome', [
'eventosFuturos' => $eventosFuturos,
'eventosPassados' => $eventosPassados
]);
}
}
......@@ -11,9 +11,7 @@
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::get('/', 'HomeController@index');
/* ----------- Rotas de Eventos ----------- */
Route::get('/eventos', 'EventController@index'); //lista todos os eventos
......
......@@ -47,9 +47,11 @@
<div class="collapse navbar-collapse" id="app-navbar-collapse">
<!-- Left Side Of Navbar -->
@unless (Auth::guest())
<ul class="nav navbar-nav">
<li><a href="{{ url('/home') }}">Início</a></li>
<li><a href="{{ url('/home') }}">Gerenciar Eventos</a></li>
</ul>
@endunless
<!-- Right Side Of Navbar -->
<ul class="nav navbar-nav navbar-right">
......
......@@ -8,9 +8,36 @@
<div class="panel-heading">Próximos eventos</div>
<div class="panel-body">
<ul class="list-group">
<li class="list-group-item">
Crazy Thursday
</li>
@if (count($eventosFuturos) > 0)
@foreach ($eventosFuturos as $evt)
<li class="list-group-item">
{{ $evt->name }}
</li>
@endforeach
@else
<li class="list-group-item">
Não eventos futuros :(
</li>
@endif
</ul>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">Eventos anteriores</div>
<div class="panel-body">
<ul class="list-group">
@if (count($eventosPassados) > 0)
@foreach ($eventosPassados as $evt)
<li class="list-group-item">
{{ $evt->name }}
</li>
@endforeach
@else
<li class="list-group-item">
Não eventos anteriores.
</li>
@endif
</ul>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment