예제 #1
0
 /**
  * Finds a user by id
  *
  * @param $user_id
  * @return mixed
  */
 public function findByUserID($user_id)
 {
     $refer = ReferQueue::where('user_id', $user_id)->first();
     if (!$refer) {
         $this->throwException("Cannot find user with id: {$user_id}, in queue.");
     }
     return $refer;
 }
예제 #2
0
 public function testJumpQueue()
 {
     $jump = 10;
     //jumps 10 places in the queue
     $ref = \Kevupton\Referrals\ReferQueue::findOrFail(20);
     $move = new \Kevupton\Referrals\Jobs\MoveInQueue($ref, $ref->position - $jump);
     $move->handle();
     $ref = \Kevupton\Referrals\ReferQueue::findOrFail(20);
     $this->assertEquals(10, $ref->position);
 }