title: Laravel 5.1 - Foreach data in form (Blade)
body: <p>i have a problem to show colors avaible of my products, i tryed to show them with blade foreach, but it doesnt work. 
  My resource controller: </p>
  
  <pre><code>public function show($id){
          $colors = Color::where('product_id', $id)-&gt;orderBy('id', 'asc');
          $product = Product::where('id', $id)-&gt;first();
  
          return view('store.show', compact('product','colors'));     
      }
  </code></pre>
  
  <p>This is my table color, i added correctly the relations
  <a href="https://i.stack.imgur.com/ZLeqk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZLeqk.jpg" alt="enter image description here"></a>
  Product Model:</p>
  
  <pre><code>namespace dixard;
  
  use Illuminate\Database\Eloquent\Model;
  use dixard\User;
  use dixard\Category;
  use dixard\Gender;
  use dixard\OrderItem;
  use dixard\Color;
  
  class Product extends Model
  {
      protected $table = 'products';
      protected $fillable = 
      [
          'name',
          'slug',
          'description',
          'extract',
          'image',
          'visible',
          'price',
          'category_id',
          'gender_id',
          'user_id'
      ];
  
      // Colleghiamo OGNI prodotto ha un utente
      public function user() {
          return $this-&gt;belongsTo('dixard\User');
      }
  
      // Colleghiamo OGNI prodotto ha una categoria
      public function category() {
          return $this-&gt;belongsTo('dixard\Category');
      }
  
      public function gender() {
          return $this-&gt;belongsTo('dixard\Gender');
      }
  
      // prodotto è contenuto in TANTI order item
      public function OrderItem() {
          return $this-&gt;belongsTo('dixard\OrderItem');
      }
  
      // prodotto è contenuto in TANTI order item
      public function Color() {
          return $this-&gt;belongsTo('dixard\Color');
      }
  }
  </code></pre>
  
  <p>Color Model</p>
  
  <pre><code>namespace dixard;
  
  use Illuminate\Database\Eloquent\Model;
  
  class Color extends Model
  {
      protected $table = 'colors';
  
      // gli dico che voglio scrivere questo campi
      protected $fillable = [
          'color',
          'product_id',
      ];
  
      public $timestamps = false;
  
      // Ogni color HA tanti prodotti. // Ogni prodotto ha tanti colori
      public function products() {
          return $this-&gt;hasMany('dixard\Product');
      }
  }
  </code></pre>
  
  <p>I'm trying to show the color avaible for my product so: </p>
  
  <pre><code>&lt;label for="p_color"&gt;Color&lt;/label&gt;
  @foreach($colors as $color)
      &lt;td&gt;{{ $color-&gt;color }}&lt;/td&gt;
  @endforeach
  </code></pre>
  
  <p>This is only test! I would like show a select option, i tryed to use BLADE but it doesnt work, </p>
  
  <ul>
  <li>get all colors where product_id = $id work fine.</li>
  <li>get the product where id = $id work fine.</li>
  </ul>
  
  <p>I think the problem is the code blade(foreach) to show all colors avaible for my product.</p>
  
  <p>how can i resolve it? Thank your help! </p>