title: Multiple CRUD system Laravel 5.2
body: <p>I want to build a CRUD system for multiple vendors to create their products in the database.</p>
  
  <p>So far I have made it so a vendor can create, read, update, delete ALL products in the database. But what I want to do is each vendor should CRUD only the products he created. How can I achieve this?</p>
  
  <p>The relationship between user and products is this:</p>
  
  <p>In Product model:</p>
  
  <pre><code>public function user(){ 
      return $this-&gt;belongsTo('App\User', 'id');
  }
  </code></pre>
  
  <p>In User model:</p>
  
  <pre><code>public function products() {
          return $this-&gt;hasMany('App\Product');
      }
  </code></pre>
  
  <p>I am presenting the products like this:</p>
  
  <pre><code>@foreach ($products as $product)
     &lt;tr&gt;
        &lt;td&gt;{{ $product-&gt;id }}&lt;/td&gt;
        &lt;td&gt;{{ $product-&gt;title }}&lt;/td&gt;
        &lt;td&gt;{{ $product-&gt;description }}&lt;/td&gt;
     &lt;/tr&gt;
  @endforeach
  </code></pre>
  
  <p>Should I use pivot tables or something? Any help is appreciated!</p>