Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/07/2013, 11:01
Montes28
 
Fecha de Ingreso: septiembre-2010
Mensajes: 1.853
Antigüedad: 14 años, 4 meses
Puntos: 6
Problemas para visualizar consulta con laravel

hola amigos espero me puedan ayudar, la situación es la siguiente

Voy a iniciar un proyecto con laravel , ya cree el proyecto con el siguiente comando

Código BASH:
Ver original
  1. composer create-project laravel/laravel miproyecto

La base de datos ya esta creada entonces no voy a utilizar la migración php artisan migrate:make

Entonces procedi a crear el modelo Registro.php
Código PHP:
Ver original
  1. <?php
  2.  
  3. use Illuminate\Auth\UserInterface;
  4. use Illuminate\Auth\Reminders\RemindableInterface;
  5.  
  6. class Registro extends Eloquent implements UserInterface, RemindableInterface {
  7.    
  8.     protected $table = 'anemometro';
  9.    
  10. }


en routes.php
Código PHP:
Ver original
  1. Route::get('registro', function()
  2. {
  3.     $registros = DB::select('SELECT * FROM anemometro ORDER BY id DESC LIMIT 1');
  4.     return View::make('registros')->with('registros', $registros);
  5. });


y en la vista tengo registros.blade.php
Código PHP:
Ver original
  1. @section('content')
  2. <br>
  3. <br>
  4. <br>
  5. <div class="container">
  6. <h3>Último Registro</h3>
  7.     @foreach($registros as $registro)
  8.         <p>{{ $registro->id }}--{{ $registro->id }}--{{ $registro->id }}</p>
  9.  
  10.     @endforeach
  11. </div>
  12. @stop


no imprime nada