public function models(Models $models) { $key = $this->getRepo()->getPrimaryKey(); $ids = $models->pluckProperty($key); $this->whereIn($key, $ids); return $this; }
/** * @covers ::pluckProperty */ public function testPluckProperty() { $models = new Models([new City(['id' => 10, 'name' => 'test1']), new City(['id' => 20, 'name' => 'test2'])]); $expected = [10, 20]; $this->assertSame($expected, $models->pluckProperty('id')); $expected = ['test1', 'test2']; $this->assertSame($expected, $models->pluckProperty('name')); }