ranjith-dev #788
@@ -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