title: Laravel 5.1 - Checking if the date expired
body: <p>i'm doing an ecommerce, i created:</p>
  
  <blockquote>
    <p>-Session "cart" with all products attributes ( price, id, quantity, category etc)</p>
    
    <p>-CouponController.php</p>
  </blockquote>
  
  <pre><code>namespace dixard\Http\Controllers;
  
  use Illuminate\Http\Request;
  
  use dixard\Http\Requests;
  use dixard\Http\Controllers\Controller;
  
  use dixard\Coupon;
  use dixard\Http\Controllers\Carbon\Carbon;
  
  class CouponController extends Controller
  
  public function postCoupon(Request $request)
          {
  
              $cart = \Session::get('cart');
  
              $mytime = Carbon\Carbon::now(); // today
  
              // i check if code coupon exist into my DB
  
              $coupon = Coupon::where('code', $request-&gt;get('coupon'))-&gt;first();
  
              if (!empty($coupon) &amp;&amp; $coupon-&gt;expire_date ) {
  
  
                  // i need check IF coupon exist AND date not expired --&gt; i will put a new price into my session cart products.  
  
              }
  
          }
  </code></pre>
  
  <blockquote>
    <p>Model Coupon.php</p>
  </blockquote>
  
  <pre><code>protected $table = 'coupons';
  
      protected $fillable = [
  
      'code', // code of coupon
      'price', // price discount
      'expire_date', // expire date of coupon
  
      ];
  </code></pre>
  
  <p>MY QUESTION</p>
  
  <p>I would like:</p>
  
  <ol>
  <li>Check with my CouponController if the code coupon is expired or not</li>
  <li>If expired return a simply message "Coupon invalid"</li>
  <li>If Coupon code exist into my DB and NOT expired, i need create a new variable with price value of coupon , for example "$discount = Coupon->price", so i can pass my discount price to my checkout view.</li>
  </ol>
  
  <p>How can i do this ? </p>
  
  <p>Thank you for yout help! ( i read something about carbon, but i dont undestand fine)   </p>