-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added zipcode and birthdate to event signup export (issue #300) #396
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #396 +/- ##
============================================
- Coverage 30.13% 30.06% -0.08%
Complexity 529 529
============================================
Files 80 80
Lines 2014 2019 +5
============================================
Hits 607 607
- Misses 1407 1412 +5 ☔ View full report in Codecov by Sentry. |
//format birthday to not include the time of day | ||
$userline["birthDay"] = substr($userline["birthDay"], 0, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest performing this attribute formatting in the User
model instead. There, we can firsts add
protected $casts = [
'birthDay' => 'date',
];
This will ensure the birthDay
attribute is always type-casted to a Carbon instance.
Then, I'd suggest defining an accessor to retrieve the "formatted birthday", as follows.
public function birthdayFormatted(): Attribute
{
return Attribute::make(
get: fn () => $this->birthDay->format('Y-m-d'),
);
}
Note that the formatted birthday value can now simply be retrieved using $user->birthdayFormatted
(not calling the function, but relying on the new property that will be magically added by the framework) or $user['birthdayFormatted']
whenever we have an instance of the user model.
"email", | ||
"phonenumber", | ||
"birthDay", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then, this would need to be changed to the birthdayFormatted
property instead.
f446c06
to
8d1c5b5
Compare
Added zipcode and birthdate to event signup export
#300