Exemple #1
0
 /**
  * The users associated sessions
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function getSessions()
 {
     $sessions = Session::find(array_unique($this->getSlots()->lists('session_id')));
     return $sessions;
 }
Exemple #2
0
 /**
  * @test
  * @large
  */
 public function testSlots()
 {
     $session = Session::find(1);
     $slots = $session->slots;
     $this->assertInstanceOf('Illuminate\\Database\\Eloquent\\Collection', $slots);
     $this->assertEquals(3, $slots->count());
     $assert = $slots[0];
     $this->assertInstanceOf('Trails\\Models\\Slot', $assert);
     $this->assertEquals(1, $assert->id);
     $this->assertEquals(1, $assert->session_id);
     $this->assertEquals(1, $assert->track_id);
     $this->assertEquals('2014-01-01 00:00:00', $assert->from);
     $this->assertEquals('2014-01-01 01:00:00', $assert->to);
     unset($assert);
     $assert = $slots[1];
     $this->assertInstanceOf('Trails\\Models\\Slot', $assert);
     $this->assertEquals(5, $assert->id);
     $this->assertEquals(1, $assert->session_id);
     $this->assertEquals(2, $assert->track_id);
     $this->assertEquals('2014-01-01 00:00:00', $assert->from);
     $this->assertEquals('2014-01-01 01:00:00', $assert->to);
     unset($assert);
     $assert = $slots[2];
     $this->assertInstanceOf('Trails\\Models\\Slot', $assert);
     $this->assertEquals(6, $assert->id);
     $this->assertEquals(1, $assert->session_id);
     $this->assertEquals(2, $assert->track_id);
     $this->assertEquals('2014-01-01 01:00:00', $assert->from);
     $this->assertEquals('2014-01-01 02:00:00', $assert->to);
 }