Added mail logic in gate out entry
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 1m54s
Laravel Larastan / larastan (pull_request) Failing after 3m15s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 17s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 1m54s
Laravel Larastan / larastan (pull_request) Failing after 3m15s
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use App\Mail\VisitorOutMail;
|
||||
use App\Models\EmployeeMaster;
|
||||
use App\Models\Plant;
|
||||
use App\Models\VisitorEntry;
|
||||
use Carbon\Carbon;
|
||||
@@ -15,6 +17,8 @@ use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use App\Mail\VisitorMail;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
|
||||
class GateOutEntry extends Page implements HasForms
|
||||
{
|
||||
@@ -162,6 +166,16 @@ class GateOutEntry extends Page implements HasForms
|
||||
$entry->out_time = now();
|
||||
$entry->save();
|
||||
|
||||
$employee = EmployeeMaster::find($entry->employee_master_id);
|
||||
|
||||
if ($employee && !empty($employee->email)) {
|
||||
Mail::to($employee->email)
|
||||
->send(new VisitorOutMail($entry)); // or ->send()
|
||||
}
|
||||
else{
|
||||
\Log::warning('No email found for employee ID: ' . $entry->employee_master_id);
|
||||
}
|
||||
|
||||
Notification::make()
|
||||
->title('Gate Pass Processed')
|
||||
->body('Visitor marked as exited.')
|
||||
|
||||
Reference in New Issue
Block a user