title: How can I deal with Coupon database design?
body: <p>I have create a simple e-commerce via Laravel, and have some questions about COUPON database design, what I need as follows:</p>
  
  <p>1- I need a normal coupon for checkout (when the user adds all products that he needs then put the coupon this will discount from the total price ). I'm done with this:</p>
  
  <pre><code> Schema::create('coupons', function (Blueprint $table) {
          $table-&gt;bigIncrements('id');
          $table-&gt;string('code');
          $table-&gt;enum('type', ['percentage', 'numeric']);
          $table-&gt;integer('value');
          $table-&gt;integer('count')-&gt;nullable();
          $table-&gt;date('expired_at');
          $table-&gt;timestamps();
    });
  </code></pre>
  
  <p>2- I need to put a discount on products of a single category (to put a discount on the whole products that belong to the T-Shirt category).</p>
  
  <pre><code>How the design structure of this point?
  </code></pre>
  
  <p>3- I need to put a discount on a specific product or products that I want to put on it.</p>
  
  <pre><code>How the design structure of this point?
  </code></pre>
  
  <blockquote>
    <p>Could anyone pls help me with this? So confused!</p>
  </blockquote>
  
  <p>Update:</p>
  
  <p>products table: </p>
  
  <pre><code>id - name - price - quantity - category_id - brand_id - created_at
  </code></pre>
  
  <p>categories table</p>
  
  <pre><code> id - category_name - created_at
  </code></pre>
  
  <p>Orders table </p>
  
  <pre><code>id - status - user_id - address_id - coupon_id - created_at
  </code></pre>
  
  <p>order_product pivot table</p>
  
  <pre><code>order_id - product_id - quantity
  </code></pre>