Hola, estoy empezando a ver laravel y estoy un poco perdido, el problema es que no me coge las vistas blade.
Mi aplicación contiene en routes.php
Route::model('game', 'Game');
Route::get('/', 'GamesController@index');
el controlador app/controllers/GamesController.php
class GamesController extends BaseController
{
public function index()
{
// Show a listing of games.
$games = Game::all();
return View::make('index', compact('games'));
}
}
y las vistas
app/views/layout.blade.php
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Games Collection</title>
<link rel="stylesheet" href="{{ asset('css/bootstrap.css') }}" />
</head>
<body>
<div class="container">
<nav class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a href="{{ action('GamesController@index') }}" class="navbar-brand">Games Collection</a>
</div>
</nav>
@yield('content')
</div>
</body>
</html>
app/views/index.blade.php
@extends('layout')
@section('content')
<div class="page-header">
<h1>All Games <small>Gotta catch 'em all!</small></h1>
</div>
<div class="panel panel-default">
<div class="panel-body">
<a href="{{ action('GamesController@create', $game->id) }}" class="btn btn-primary">Create Game</a>
</div>
</div>
@if ($games->isEmpty())
<p>There are no games! :(</p>
@else
<table class="table table-striped">
<thead>
<tr>
<th>Title</th>
<th>Publisher</th>
<th>Complete</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
@foreach($games as $game)
<tr>
<td>{{ $game->title }}</td>
<td>{{ $game->publisher }}</td>
<td>{{ $game->complete ? 'Yes' : 'No' }}</td>
<td>
<a href="{{ action('GamesController@edit', $game->id) }}" class="btn btn-default">Edit</a>
<a href="{{ action('GamesController@delete', $game->id) }}" class="btn btn-danger">Delete</a>
</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@stop
Creo que son las vistas por que si cambio el nombre de index.blade.php a index.php me entra aunque mostrandome el codigo laravel como texto, el erro que me da es Undefined variable: game (View: C:\xampp\htdocs\games\app\views\index.blade.php), he provado a cambiar el código del controlador a
$games = new Game();
$games = Game::all();
return View::make('index', compact('games'));
o tambien
$games = new Game();
$games = Game::all();
return View::make('index', $games);
y me sigue dando el error de variable indefinida, no se que estoy haciendo mal.
Gracias, saludos