public function intersect($items) { return new static(array_intersect($this->items, $this->getArrayableItems($items))); }
public function testIntersectCollection() { $c = new Collection(['id' => 1, 'first_word' => 'Hello']); $this->assertEquals(['first_word' => 'Hello'], $c->intersect(new Collection(['first_world' => 'Hello', 'last_word' => 'World']))->all()); }