Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Illuminate/Database/Eloquent/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function lists($column, $key = null)
// If the model has a mutator for the requested column, we will spin through
// the results and mutate the values so that the mutated version of these
// columns are returned as you would expect from these Eloquent models.
if ($this->model->hasGetMutator($column))
if ($this->model->getMutatorMethod($column))
{
foreach ($results as $key => &$value)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Database/DatabaseEloquentBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public function testListsReturnsTheMutatedAttributesOfAModel()
$builder = $this->getBuilder();
$builder->getQuery()->shouldReceive('lists')->with('name', '')->andReturn(array('bar', 'baz'));
$builder->setModel($this->getMockModel());
$builder->getModel()->shouldReceive('hasGetMutator')->with('name')->andReturn(true);
$builder->getModel()->shouldReceive('getMutatorMethod')->with('name')->andReturn(true);
$builder->getModel()->shouldReceive('newFromBuilder')->with(array('name' => 'bar'))->andReturn(new EloquentBuilderTestListsStub(array('name' => 'bar')));
$builder->getModel()->shouldReceive('newFromBuilder')->with(array('name' => 'baz'))->andReturn(new EloquentBuilderTestListsStub(array('name' => 'baz')));

Expand All @@ -188,7 +188,7 @@ public function testListsWithoutModelGetterJustReturnTheAttributesFoundInDatabas
$builder = $this->getBuilder();
$builder->getQuery()->shouldReceive('lists')->with('name', '')->andReturn(array('bar', 'baz'));
$builder->setModel($this->getMockModel());
$builder->getModel()->shouldReceive('hasGetMutator')->with('name')->andReturn(false);
$builder->getModel()->shouldReceive('getMutatorMethod')->with('name')->andReturn(false);

$this->assertEquals(array('bar', 'baz'), $builder->lists('name'));
}
Expand Down