title: How do I use Eloquent ORM to retrieve data from a database in Laravel
body: <p>I'm new to MVC and do not understand it very much at all. I have a database with one table called <code>products</code></p>
  
  <p>I have a Model called <code>Product</code>which looks like</p>
  
  <pre><code>&lt;?php
  
  class Product extends Eloquent {
  
      // MASS ASSIGNMENT -------------------------------------------------------
      // define which attributes are mass assignable (for security)
      // we only want these 3 attributes able to be filled
      protected $fillable = array('type', 'brand', 'image');
  
  }
  </code></pre>
  
  <p>I have a Route like so</p>
  
  <pre><code>Route::get('products', function()
  {
      return View::make('products');
  });
  </code></pre>
  
  <p>And my View looks like this</p>
  
  <pre><code>@extends('master')
  
  @section('content')
      PRODUCTS
  
      @foreach($products as $product)
  
          {{ $product-&gt;type }}
  
      @endforeach
  @stop
  </code></pre>
  
  <p>I see you can get all the rows like so <code>$products = Product::all();</code> but I don't understand WHERE this goes. Does it go in the View? Does it go in the Model? Does it go in the Route? My current @foreach loop just results in an <code>undefined variable: products</code></p>
  
  <p>Can someone please clarify?</p>