Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. private static function GeneratePayCode($companyID = null){
  2. $result = false;
  3.  
  4. if(isset($companyID)){
  5. $payCode = 'COMP' . $companyID . '' . Carbon::now()->timeZone('Asia/Jakarta')->format('ymd') . strtoupper(str_random(3));
  6. $validator = Validator::make(['payment_code' => $payCode],['payment_code'=>'unique:vb_company_payment,payment_code']);
  7. if ($validator->fails()) {
  8. Self::GeneratePayCode($companyID);
  9. }else{
  10. $result = $payCode;
  11. }
  12. }
  13.  
  14. return $result;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement