public function testGetAllChildren() { // Not eager loaded $item = CategorySimple::first(); $this->assertEquals(9, $item->getAllChildren()->count()); // Eager loaded $item = CategorySimple::make()->getAllRoot()->first(); $this->assertEquals(9, $item->getAllChildren()->count()); }
public function testGetAllChildren() { // Not eager loaded $item = CategorySimple::first(); $this->assertFalse($item->relationLoaded('children')); $this->assertEquals(9, $item->getAllChildren()->count()); // Not eager loaded $item = CategorySimple::getAllRoot()->first(); $this->assertFalse($item->relationLoaded('children')); $this->assertEquals(9, $item->getAllChildren()->count()); // Eager loaded $item = CategorySimple::getNested()->first(); $this->assertTrue($item->relationLoaded('children')); $this->assertEquals(9, $item->getAllChildren()->count()); }