-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added more subjects to the dashboard --welcome
- Loading branch information
1 parent
6671510
commit 8a9b538
Showing
6 changed files
with
87 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
|
||
namespace App\Http\Controllers; | ||
|
||
use Illuminate\Support\Facades\Mail; | ||
use Illuminate\View\View; | ||
use Illuminate\Http\Request; | ||
|
||
class PagesController extends Controller | ||
{ | ||
|
@@ -15,4 +17,24 @@ public function contact(): View | |
{ | ||
return view('contact'); | ||
} | ||
|
||
public function submit(Request $request) | ||
{ | ||
// Validate the form data | ||
$request->validate([ | ||
'name' => 'required', | ||
'email' => 'required|email', | ||
'user_message' => 'required', | ||
]); | ||
|
||
// Send the email | ||
Mail::send('emails.contact', $request->all(), function ($message) { | ||
//email from env | ||
$owner_email = env('OWNER_EMAIL' ?? '[email protected]'); | ||
$message->to($owner_email)->subject('Contact Form Submission'); | ||
}); | ||
|
||
// Redirect or return a response | ||
return redirect()->back()->with('success', 'Thank you for your message!'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Contact Form Submission</title> | ||
<style> | ||
body { | ||
font-family: Arial, sans-serif; | ||
margin: 0; | ||
padding: 0; | ||
background-color: #f8f9fa; | ||
} | ||
.container { | ||
width: 80%; | ||
margin: auto; | ||
padding: 20px; | ||
} | ||
h1 { | ||
color: #6c757d; | ||
} | ||
p { | ||
color: #6c757d; | ||
font-size: 1.1em; | ||
line-height: 1.6; | ||
} | ||
strong { | ||
color: #495057; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<h1>Contact Form Submission</h1> | ||
|
||
<p><strong>Name:</strong> {{ $name }}</p> | ||
<p><strong>Email:</strong> {{ $email }}</p> | ||
<p><strong>Message:</strong> {{ $user_message }}</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters