Fixed: Joined_at can be null

This commit is contained in:
philipp lang 2020-07-04 01:46:03 +02:00
parent 2f21031d49
commit 39bf3fc7f8
2 changed files with 10 additions and 13 deletions

View File

@ -78,14 +78,12 @@ class Member extends Model {
$this->attributes['gender_id'] = data_get($this->geschlechtMaps, $v, null); $this->attributes['gender_id'] = data_get($this->geschlechtMaps, $v, null);
} }
public function getAttributeValue($key) { public function setAttribute($key, $value) {
$original = parent::getAttributeValue($key); if (in_array($key, $this->nullable) && $value === '') {
return parent::setAttribute($key, null);
if (in_array($key, $this->nullable) && $original === '') {
return null;
} }
return $original; return parent::setAttribute($key, $value);
} }
} }

View File

@ -79,8 +79,8 @@ class PullMemberTest extends TestCase
$group = Nami::group(103); $group = Nami::group(103);
$this->assertSame($values[0], $group->member(16)->{$key}); $this->assertSame($values[0], $group->member(16)->toArray()[$key]);
$this->assertSame($values[1], $group->member(17)->{$key}); $this->assertSame($values[1], $group->member(17)->toArray()[$key]);
Http::assertSentCount(5); Http::assertSentCount(5);
} }
@ -100,10 +100,9 @@ class PullMemberTest extends TestCase
Nami::login(); Nami::login();
$this->assertSame([ $member = Nami::group(103)->members();
16 => $values[0], $this->assertSame($values[0], $member->get(0)->toArray()[$key]);
17 => $values[1] $this->assertSame($values[1], $member->get(1)->toArray()[$key]);
], Nami::group(103)->members()->pluck($key, 'id')->toArray());
Http::assertSentCount(6); Http::assertSentCount(6);
} }
@ -147,7 +146,7 @@ class PullMemberTest extends TestCase
$group = Nami::group(103); $group = Nami::group(103);
$this->assertSame($values[0], $group->member(16)->{$key}); $this->assertSame($values[0], $group->member(16)->toArray()[$key]);
Http::assertSentCount(5); Http::assertSentCount(5);
} }