Skip to content

Commit e8fabb4

Browse files
committed
Mail Template
1 parent 830c932 commit e8fabb4

File tree

20 files changed

+546
-0
lines changed

20 files changed

+546
-0
lines changed

app/Http/Controllers/Admin/CheckoutController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
use App\Http\Controllers\Controller;
66
use Illuminate\Http\Request;
77
use App\Models\Checkout;
8+
use Mail;
9+
use App\Mail\Checkout\Paid;
10+
811

912
class CheckoutController extends Controller
1013
{
@@ -13,6 +16,9 @@ public function update(Request $request, Checkout $checkout)
1316
$checkout->is_paid = true;
1417
$checkout->save();
1518
$request->session()->flash('success', "Checkout {$checkout->Camp->title} by {$checkout->User->name} has been Updated!");
19+
20+
// email
21+
Mail::to($checkout->User->email)->send(new Paid($checkout));
1622
return redirect(route('admin.dashboard'));
1723
}
1824
}

app/Mail/Checkout/Paid.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
3+
namespace App\Mail\Checkout;
4+
5+
use Illuminate\Bus\Queueable;
6+
use Illuminate\Contracts\Queue\ShouldQueue;
7+
use Illuminate\Mail\Mailable;
8+
use Illuminate\Queue\SerializesModels;
9+
10+
class Paid extends Mailable
11+
{
12+
use Queueable, SerializesModels;
13+
14+
private $checkout;
15+
16+
/**
17+
* Create a new message instance.
18+
*
19+
* @return void
20+
*/
21+
public function __construct($checkout)
22+
{
23+
$this->checkout = $checkout;
24+
}
25+
26+
/**
27+
* Build the message.
28+
*
29+
* @return $this
30+
*/
31+
public function build()
32+
{
33+
return $this->subject("Your transaction has been confirmed")
34+
->markdown('emails.checkout.paid',
35+
[
36+
'checkout' => $this->checkout
37+
]);
38+
}
39+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@component('mail::message')
2+
# Dear {{$checkout->User->name}},
3+
4+
<br>
5+
I wanted to take a moment to express my sincere gratitude for your prompt payment of the <strong>{{$checkout->Camp->title}}</strong>. Your prompt action has made it possible for me to continue delivering quality educational content to my students.
6+
<br> <br>
7+
Your support means a lot to me and I am grateful for having such a responsible and committed participant in my course. I am confident that the knowledge and skills you will gain from this program will be beneficial in your personal and professional life.
8+
<br>
9+
10+
@component('mail::button', ['url' => route('dashboard')])
11+
Start Learning
12+
@endcomponent
13+
14+
Thank you again for your payment. If there is anything else I can do for you, please do not hesitate to let me know.
15+
<br>
16+
17+
Best Regards,<br>
18+
{{ config('app.name') }}
19+
@endcomponent
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<table class="action" align="center" width="100%" cellpadding="0" cellspacing="0" role="presentation">
2+
<tr>
3+
<td align="center">
4+
<table width="100%" border="0" cellpadding="0" cellspacing="0" role="presentation">
5+
<tr>
6+
<td align="center">
7+
<table border="0" cellpadding="0" cellspacing="0" role="presentation">
8+
<tr>
9+
<td>
10+
<a href="{{ $url }}" class="button button-{{ $color ?? 'primary' }}" target="_blank" rel="noopener">{{ $slot }}</a>
11+
</td>
12+
</tr>
13+
</table>
14+
</td>
15+
</tr>
16+
</table>
17+
</td>
18+
</tr>
19+
</table>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<tr>
2+
<td>
3+
<table class="footer" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
4+
<tr>
5+
<td class="content-cell" align="center">
6+
{{ Illuminate\Mail\Markdown::parse($slot) }}
7+
</td>
8+
</tr>
9+
</table>
10+
</td>
11+
</tr>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<tr>
2+
<td class="header">
3+
<a href="{{ $url }}" style="display: inline-block;">
4+
@if (trim($slot) === 'Laravel')
5+
<img src="https://laravel.com/img/notification-logo.png" class="logo" alt="Laravel Logo">
6+
@else
7+
{{ $slot }}
8+
@endif
9+
</a>
10+
</td>
11+
</tr>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6+
<meta name="color-scheme" content="light">
7+
<meta name="supported-color-schemes" content="light">
8+
<style>
9+
@media only screen and (max-width: 600px) {
10+
.inner-body {
11+
width: 100% !important;
12+
}
13+
14+
.footer {
15+
width: 100% !important;
16+
}
17+
}
18+
19+
@media only screen and (max-width: 500px) {
20+
.button {
21+
width: 100% !important;
22+
}
23+
}
24+
</style>
25+
</head>
26+
<body>
27+
28+
<table class="wrapper" width="100%" cellpadding="0" cellspacing="0" role="presentation">
29+
<tr>
30+
<td align="center">
31+
<table class="content" width="100%" cellpadding="0" cellspacing="0" role="presentation">
32+
{{ $header ?? '' }}
33+
34+
<!-- Email Body -->
35+
<tr>
36+
<td class="body" width="100%" cellpadding="0" cellspacing="0">
37+
<table class="inner-body" align="center" width="570" cellpadding="0" cellspacing="0" role="presentation">
38+
<!-- Body content -->
39+
<tr>
40+
<td class="content-cell">
41+
{{ Illuminate\Mail\Markdown::parse($slot) }}
42+
43+
{{ $subcopy ?? '' }}
44+
</td>
45+
</tr>
46+
</table>
47+
</td>
48+
</tr>
49+
50+
{{ $footer ?? '' }}
51+
</table>
52+
</td>
53+
</tr>
54+
</table>
55+
</body>
56+
</html>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
@component('mail::layout')
2+
{{-- Header --}}
3+
@slot('header')
4+
@component('mail::header', ['url' => config('app.url')])
5+
{{ config('app.name') }}
6+
@endcomponent
7+
@endslot
8+
9+
{{-- Body --}}
10+
{{ $slot }}
11+
12+
{{-- Subcopy --}}
13+
@isset($subcopy)
14+
@slot('subcopy')
15+
@component('mail::subcopy')
16+
{{ $subcopy }}
17+
@endcomponent
18+
@endslot
19+
@endisset
20+
21+
{{-- Footer --}}
22+
@slot('footer')
23+
@component('mail::footer')
24+
© {{ date('Y') }} {{ config('app.name') }}. @lang('All rights reserved.')
25+
@endcomponent
26+
@endslot
27+
28+
@endcomponent
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<table class="panel" width="100%" cellpadding="0" cellspacing="0" role="presentation">
2+
<tr>
3+
<td class="panel-content">
4+
<table width="100%" cellpadding="0" cellspacing="0" role="presentation">
5+
<tr>
6+
<td class="panel-item">
7+
{{ Illuminate\Mail\Markdown::parse($slot) }}
8+
</td>
9+
</tr>
10+
</table>
11+
</td>
12+
</tr>
13+
</table>
14+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<table class="subcopy" width="100%" cellpadding="0" cellspacing="0" role="presentation">
2+
<tr>
3+
<td>
4+
{{ Illuminate\Mail\Markdown::parse($slot) }}
5+
</td>
6+
</tr>
7+
</table>

0 commit comments

Comments
 (0)