Skip to content

Commit

Permalink
Added more subjects to the dashboard --welcome
Browse files Browse the repository at this point in the history
  • Loading branch information
Raccoon254 committed May 27, 2024
1 parent 6671510 commit 8a9b538
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 11 deletions.
22 changes: 22 additions & 0 deletions app/Http/Controllers/PagesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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!');
}
}
2 changes: 1 addition & 1 deletion app/Livewire/OrderCreate.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function createOrder()

$this->reset(['title', 'description', 'total_price']);

return redirect()->route('orders.pay', ['order' => $order->id]);
return redirect()->route('orders.pay', ['orderId' => $order->id]);
}

public function render(): View
Expand Down
29 changes: 21 additions & 8 deletions app/Livewire/PriceCalculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,27 @@ class PriceCalculator extends Component
public int $price = 0;

public array $subjects = [
'Mathematics',
'Physics',
'Chemistry',
'Biology',
'English',
'History',
'Geography',
'Computer Science'
'Engineering',
'Agriculture',
'Accounting',
'Computer Science',
'Research paper',
'Essay (any type)',
'Admission essay',
'Annotated bibliography',
'Argumentative essay',
'Article review',
'Book/movie review',
'Business plan',
'Case study',
'Coursework',
'Creative writing',
'Critical thinking',
'Presentation or speech',
'Research proposal',
'Term paper',
'Thesis/Dissertation chapter',
'Other'
];

public function placeOrder(): void
Expand Down
2 changes: 1 addition & 1 deletion resources/views/contact.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</div>
<div class="mb-4">
<label for="message" class="block text-black/70 font-semibold mb-2">Message</label>
<textarea name="message" id="message" cols="30" rows="6" class="w-full textarea bg-white border border-gray-300 rounded-lg shadow-sm" required></textarea>
<textarea name="user_message" id="message" cols="30" rows="6" class="w-full textarea bg-white border border-gray-300 rounded-lg shadow-sm" required></textarea>
</div>
<div>
<button class="custom-btn w-full" type="submit">Submit</button>
Expand Down
41 changes: 41 additions & 0 deletions resources/views/emails/contact.blade.php
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>
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@
});

Route::get('/contact', [PagesController::class, 'contact'])->name('contact');
Route::post('/contact', [PagesController::class, 'contact_submit'])->name('contact.submit');
Route::post('/contact', [PagesController::class, 'submit'])->name('contact.submit');
require __DIR__.'/auth.php';

0 comments on commit 8a9b538

Please sign in to comment.