diff --git a/src/Member.php b/src/Member.php index b0bd721..8ae4a3e 100644 --- a/src/Member.php +++ b/src/Member.php @@ -78,14 +78,12 @@ class Member extends Model { $this->attributes['gender_id'] = data_get($this->geschlechtMaps, $v, null); } - public function getAttributeValue($key) { - $original = parent::getAttributeValue($key); - - if (in_array($key, $this->nullable) && $original === '') { - return null; + public function setAttribute($key, $value) { + if (in_array($key, $this->nullable) && $value === '') { + return parent::setAttribute($key, null); } - return $original; + return parent::setAttribute($key, $value); } } diff --git a/tests/Unit/PullMemberTest.php b/tests/Unit/PullMemberTest.php index 3ed575c..25793ec 100644 --- a/tests/Unit/PullMemberTest.php +++ b/tests/Unit/PullMemberTest.php @@ -79,8 +79,8 @@ class PullMemberTest extends TestCase $group = Nami::group(103); - $this->assertSame($values[0], $group->member(16)->{$key}); - $this->assertSame($values[1], $group->member(17)->{$key}); + $this->assertSame($values[0], $group->member(16)->toArray()[$key]); + $this->assertSame($values[1], $group->member(17)->toArray()[$key]); Http::assertSentCount(5); } @@ -100,10 +100,9 @@ class PullMemberTest extends TestCase Nami::login(); - $this->assertSame([ - 16 => $values[0], - 17 => $values[1] - ], Nami::group(103)->members()->pluck($key, 'id')->toArray()); + $member = Nami::group(103)->members(); + $this->assertSame($values[0], $member->get(0)->toArray()[$key]); + $this->assertSame($values[1], $member->get(1)->toArray()[$key]); Http::assertSentCount(6); } @@ -147,7 +146,7 @@ class PullMemberTest extends TestCase $group = Nami::group(103); - $this->assertSame($values[0], $group->member(16)->{$key}); + $this->assertSame($values[0], $group->member(16)->toArray()[$key]); Http::assertSentCount(5); }