Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static function GeneratePayCode($companyID = null){
- $result = false;
- if(isset($companyID)){
- $payCode = 'COMP' . $companyID . '' . Carbon::now()->timeZone('Asia/Jakarta')->format('ymd') . strtoupper(str_random(3));
- $validator = Validator::make(['payment_code' => $payCode],['payment_code'=>'unique:vb_company_payment,payment_code']);
- if ($validator->fails()) {
- Self::GeneratePayCode($companyID);
- }else{
- $result = $payCode;
- }
- }
- return $result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement