Conversation
So larval’s mail system is tightly coupled to eloquent models and as such expects public name and email properties available on the an model that is pass to Mail::to($model) Declaring email public is an easy switch but early on in dev we renamed the name column to first name, so rather than changing the DB back I’ve use the mapping to override it in the entity Im also leaving the Firstname getters and setter in place
|
last commit will also close #143 |
7a08f4e to
37ff3f8
Compare
85e25f3 to
137e70a
Compare
Add `TRUSTEE_SLACK_WEBHOOK` & `TEAM_SLACK_WEBHOOK` to your .env to test (with suitable incoming web hook url’s)
app/HMS/Entities/Role.php
Outdated
| if ($this->name = 'team.Trustees') { | ||
| return Meta::get('trustee_slack_webhook'); | ||
| if ($this->name == self::TEAM_TRUSTEES) { | ||
| return env('TRUSTEE_SLACK_WEBHOOK', ''); |
There was a problem hiding this comment.
Do this as a configuration parameter? Pulling from the same env var?
| * @return array | ||
| */ | ||
| public function searchLike(string $searchQuery) | ||
| public function searchLike(string $searchQuery, ?bool $hasAccount = false) |
There was a problem hiding this comment.
Nullable bool?
Is this because some callers might not pass a value?
There was a problem hiding this comment.
I'm calling with $this->userRepository->searchLike($searchQuery, $request->input('withAccount', false))
and $request->input can return null
| * @param Illuminate\Http\Request $request | ||
| * @return User | ||
| */ | ||
| public function updateUserProfileFromRequest(User $user, Request $request) |
There was a problem hiding this comment.
Has this request been sanitized before it gets here? I forget laravels functionings.
| return redirect()->route('home'); | ||
| } | ||
|
|
||
| $this->validate($request, [ |
|
|
||
| namespace App\Http\Controllers; | ||
|
|
||
| use HMS\Entities\Role; |
There was a problem hiding this comment.
As an aside the number of includes here tells me this is quite the fat controller. Might be worth figuring out how we can offload some of this stuff to some service classes.
| 'reason' => 'required|string|max:500', | ||
| ]); | ||
|
|
||
| \Mail::to($user)->send(new MembershipDetailsRejected($user, $request['reason'])); |
| $membershipTeamRole = $this->roleRepository->findByName(Role::TEAM_MEMBERSHIP); | ||
| $membershipTeamRole->notify(new NewMemberApprovalNeeded($user, true)); | ||
|
|
||
| flash('Your detials have been updated and another review requested, thank you.')->success(); |
| @@ -27,6 +40,6 @@ public function __construct() | |||
| public function handle(MembershipInterestRegistered $event) | |||
| { | |||
| \Mail::to($event->invite->getEmail()) | |||
There was a problem hiding this comment.
ALready using listeners to mail for some things.
|
|
||
| <form role="form" method="POST" action="{{ route('membership.update', $user->getId()) }}"> | ||
| {{ csrf_field() }} | ||
| {{ method_field('PUT') }} |
There was a problem hiding this comment.
Why put from a POST form?
|
|
||
| @section('content') | ||
| <h1>New member detials review</h1> | ||
| <p>Please review the details below and check they are all sane.</p> |
There was a problem hiding this comment.
Maybe 'sane' isn't the most PC term.
"Please review the details below to check they are all correct"?
# Conflicts: # app/HMS/Entities/User.php
finally close #111
This wil take users form approval to awaiting payment stage, notifying the membership team about the need to review and approve details