- fix users cannot reset password due session expiration - add a new mail when users contacts via Contact form - add list page for all deals in broker dashboard - fixed links in home page
25 lines
743 B
PHP
25 lines
743 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Http\Requests\ContactRequest;
|
|
use App\Models\Admin;
|
|
use App\Notifications\NewContactNotification;
|
|
|
|
class ContactController extends Controller
|
|
{
|
|
public function __invoke(ContactRequest $request)
|
|
{
|
|
try {
|
|
|
|
$data = $request->validated();
|
|
$admin = Admin::first();
|
|
$admin->user->notify(new NewContactNotification($data['name'], $data['email'], $data['message']));
|
|
return back()->with('success', 'Your message has been sent successfully.');
|
|
} catch (\Throwable $e) {
|
|
\Log::error('Error sending contact message', [$e->getMessage()]);
|
|
return back()->with('error', 'Something went wrong.');
|
|
}
|
|
}
|
|
}
|