Example #1
0
 /**
  * Execute the job.
  *
  * @return void
  */
 public function handle()
 {
     $interval = ref_conf('addmore.interval', 3600);
     $amount = ref_conf('addmore.amount', 1);
     for ($i = 0; $i < $amount; $i++) {
         $this->repo->addToQueue();
     }
     $job = (new AddMore())->delay($interval);
     $this->dispatch($job);
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     $prefix = ref_prefix();
     $start_at = ref_conf('start_at', 0);
     Schema::create($prefix . 'config', function (Blueprint $table) {
         $table->string('key', 32);
         $table->text('value');
         $table->primary('key');
     });
     Config::create(['key' => 'start_at', 'value' => $start_at]);
     Config::create(['key' => 'db_prefix', 'value' => $prefix]);
     //        if ( ! Schema::hasTable($prefix . 'subscribers')) {
     //            Schema::create($prefix . 'subscribers', function (Blueprint $table) {
     //                $table->increments('id');
     //                $table->string('mevu_tag', 32)->unique();
     //                $table->string('name', 125);
     //                $table->string('email');
     //                $table->string('ref_code');
     //                $table->tinyInteger('is_win_prize');
     //                $table->integer('points');
     //                $table->integer('referrals');
     //                $table->timestamps();
     //            });
     //        }
     if (!Schema::hasTable($prefix . 'refer_queue')) {
         Schema::create($prefix . 'refer_queue', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id')->nullable()->unique();
             $table->integer('position')->unique();
         });
         if ($start_at) {
             $string = "INSERT INTO {$prefix}" . "refer_queue (position) VALUES";
             for ($i = 1; $i <= $start_at; $i++) {
                 $string .= "({$i}),";
             }
             $string = trim($string, ",");
             DB::insert($string);
         }
     }
 }
Example #3
0
 /**
  * Gets the jump count for each referral
  *
  * @return int
  */
 function ref_jumps()
 {
     return ref_conf('jump_count');
 }
Example #4
0
 /**
  * A basic functional test example.
  *
  * @return void
  */
 public function testTheStartAt()
 {
     $start_at = ref_conf('start_at', 0);
     $this->assertEquals($start_at, \Kevupton\Referrals\ReferQueue::all()->count());
 }