Esempio n. 1
0
 /**
  * Generate a unique ref for a new Order.
  *
  * @return string
  */
 function generate()
 {
     $today = date("Ymd");
     $order = Order::orderBy("ref", "desc")->first();
     if (!$order) {
         return "{$today}-1";
     }
     list($date, $increment) = explode("-", $order->ref);
     $increment++;
     return "{$today}-{$increment}";
 }
Esempio n. 2
0
 /**
  * Generate a unique ref for a new Order.
  *
  * @return string
  */
 function generate()
 {
     $order = Order::orderBy("ref", "desc")->first();
     return $order ? $order->ref + 1 : 1;
 }