Skip to content
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

Update Mass update method in email controller #1704

Closed
wants to merge 7 commits into from
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
2. [Documentation](#documentation)
3. [Requirements](#requirements)
4. [Installation & Configuration](#installation-and-configuration)
4. [Docker Installation](https://devdocs.krayincrm.com/2.0/introduction/docker.html)
5. [License](#license)
6. [Security Vulnerabilities](#security-vulnerabilities)

Expand Down
1 change: 1 addition & 0 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@
'es' => 'Español',
'fa' => 'Persian',
'tr' => 'Türkçe',
'vi' => 'Vietnamese',
],

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,17 +231,17 @@ public function download($id)
*/
public function massUpdate(MassUpdateRequest $massUpdateRequest): JsonResponse
{
$leads = $this->leadRepository->findWhereIn('id', $massUpdateRequest->input('indices'));
$emails = $this->emailRepository->findWhereIn('id', $massUpdateRequest->input('indices'));

try {
foreach ($leads as $lead) {
Event::dispatch('email.update.before', $lead->id);
foreach ($emails as $email) {
Event::dispatch('email.update.before', $email->id);

$this->emailRepository->update([
'folders' => request('folders'),
], $lead->id);
], $email->id);

Event::dispatch('email.update.after', $lead->id);
Event::dispatch('email.update.after', $email->id);
}

return response()->json([
Expand Down
Loading
Loading