Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
T
test-webshop
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Artem
test-webshop
Commits
52f77418
Commit
52f77418
authored
May 13, 2020
by
Artem
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add queue for sending order confirmation using database driver
parent
674f8f68
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
15 deletions
+41
-15
OrderController.php
app/Http/Controllers/OrderController.php
+3
-1
OrderConfirmation.php
app/Mail/OrderConfirmation.php
+1
-1
2020_05_13_071545_create_jobs_table.php
database/migrations/2020_05_13_071545_create_jobs_table.php
+36
-0
order-confirmation.blade.php
resources/views/emails/order-confirmation.blade.php
+1
-13
No files found.
app/Http/Controllers/OrderController.php
View file @
52f77418
...
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers
;
use
App\Jobs\SendOrderConfirmation
;
use
App\Mail\OrderConfirmation
;
use
App\Order
;
use
App\OrderDetail
;
...
...
@@ -49,8 +50,9 @@ class OrderController extends Controller
// ->subject('Order subject');
// });
Mail
::
to
(
$order
->
user
->
email
)
->
send
(
new
OrderConfirmation
(
$order
->
id
));
->
queue
(
new
OrderConfirmation
(
$order
->
id
));
return
redirect
(
'cart'
)
->
with
(
'order_id'
,
$order
->
id
);
}
...
...
app/Mail/OrderConfirmation.php
View file @
52f77418
...
...
@@ -30,7 +30,7 @@ class OrderConfirmation extends Mailable
*/
public
function
build
()
{
return
$this
->
view
(
'emails.order-confirmation'
)
return
$this
->
text
(
'emails.order-confirmation'
)
->
subject
(
'Order confirmation '
.
$this
->
order_id
);
}
}
database/migrations/2020_05_13_071545_create_jobs_table.php
0 → 100644
View file @
52f77418
<?php
use
Illuminate\Database\Migrations\Migration
;
use
Illuminate\Database\Schema\Blueprint
;
use
Illuminate\Support\Facades\Schema
;
class
CreateJobsTable
extends
Migration
{
/**
* Run the migrations.
*
* @return void
*/
public
function
up
()
{
Schema
::
create
(
'jobs'
,
function
(
Blueprint
$table
)
{
$table
->
bigIncrements
(
'id'
);
$table
->
string
(
'queue'
)
->
index
();
$table
->
longText
(
'payload'
);
$table
->
unsignedTinyInteger
(
'attempts'
);
$table
->
unsignedInteger
(
'reserved_at'
)
->
nullable
();
$table
->
unsignedInteger
(
'available_at'
);
$table
->
unsignedInteger
(
'created_at'
);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public
function
down
()
{
Schema
::
dropIfExists
(
'jobs'
);
}
}
resources/views/emails/order-confirmation.blade.php
View file @
52f77418
<!doctype html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
>
<meta
http-equiv=
"X-UA-Compatible"
content=
"ie=edge"
>
<title>
Document
</title>
</head>
<body>
<p>
Thank you for order. Your order number is {{ $order_id }}. We will contact you shortly.
</p>
</body>
</html>
Thank
you
for
order
.
Your
order
number
is
{{
$order_id
}}
.
We
will
contact
you
shortly
.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment