mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-02 19:04:33 -04:00
Add email notification for client unsubscribe
This commit is contained in:
parent
4377a05716
commit
5fba841ce6
@ -13,6 +13,10 @@
|
|||||||
namespace App\Http\Controllers\ClientPortal;
|
namespace App\Http\Controllers\ClientPortal;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Jobs\Mail\NinjaMailer;
|
||||||
|
use App\Jobs\Mail\NinjaMailerJob;
|
||||||
|
use App\Jobs\Mail\NinjaMailerObject;
|
||||||
|
use App\Mail\Admin\ClientUnsubscribedObject;
|
||||||
use App\Models\ClientContact;
|
use App\Models\ClientContact;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@ -39,6 +43,16 @@ class EmailPreferencesController extends Controller
|
|||||||
$clientContact->is_locked = $request->has('recieve_emails') ? false : true;
|
$clientContact->is_locked = $request->has('recieve_emails') ? false : true;
|
||||||
$clientContact->save();
|
$clientContact->save();
|
||||||
|
|
||||||
|
if ($clientContact->is_locked) {
|
||||||
|
$nmo = new NinjaMailerObject();
|
||||||
|
$nmo->mailable = new NinjaMailer((new ClientUnsubscribedObject($clientContact, $clientContact->company))->build());
|
||||||
|
$nmo->company = $clientContact->company;
|
||||||
|
$nmo->to_user = $clientContact->company->owner();
|
||||||
|
$nmo->settings = $clientContact->company->settings;
|
||||||
|
|
||||||
|
(new NinjaMailerJob($nmo))->handle();
|
||||||
|
}
|
||||||
|
|
||||||
return back()->with('message', ctrans('texts.updated_settings'));
|
return back()->with('message', ctrans('texts.updated_settings'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user