public function update()
 {
     $part = Input::get('lka_part');
     SettingDAO::setValue("LKA_PART", $part);
     Session::flash('message', "LKA Setting telah di ubah!");
     return Redirect::to('/dash/setting/lka');
 }
Exemple #2
0
 public static function getLKA()
 {
     $pad = 4;
     $rand_max = 9999;
     $yearDb = SettingDAO::getValue("LKA_YEAR");
     $monthDb = SettingDAO::getValue("LKA_MONTH");
     $yearNow = date('Y');
     $part = SettingDAO::getValue('LKA_PART');
     $num = rand(1, $rand_max);
     //random number
     $number = str_pad($num, $pad, "0", STR_PAD_LEFT);
     $year = date('Y');
     if ($yearDb != $yearNow) {
         $num = rand(1, $rand_max);
         //random number
         $number = str_pad($num, $pad, "0", STR_PAD_LEFT);
         $year = $yearNow;
     }
     $year = date('Y');
     $month = RomanHelper::numberToRoman(date('m'));
     $lka = $number . '/' . $part . '/' . $month . '/' . $year;
     $unique = false;
     while ($unique == false) {
         $f = Form::where('no_lka', '=', $lka)->count();
         if ($f == 0) {
             $unique = true;
             //or break looping
         } else {
             $num = rand(1, $rand_max);
             //random number
             $number = str_pad($num, $pad, "0", STR_PAD_LEFT);
             $lka = $number . '/' . $part . '/' . $month . '/' . $year;
             $f = Form::where('no_lka', '=', $lka)->count();
             if ($f == 0) {
                 $unique == true;
             }
         }
     }
     return $lka;
 }