Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Laravel 5.x Cookbook

You're reading from   Laravel 5.x Cookbook A recipe-based book to help you efficiently create amazing PHP-based applications with Laravel 5.x

Arrow left icon
Product type Paperback
Published in Sep 2016
Publisher Packt
ISBN-13 9781786462084
Length 402 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Terry Matula Terry Matula
Author Profile Icon Terry Matula
Terry Matula
Alfred Nutile Alfred Nutile
Author Profile Icon Alfred Nutile
Alfred Nutile
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Setting Up and Installing Laravel FREE CHAPTER 2. Using Composer Packages 3. Routing 4. Building Views and Adding Style 5. Working with Data 6. Adding Angular to Your App 7. Authentication, Security, and Subscriptions 8. Testing and Debugging Your Application 9. Adding Advanced Features to Your App 10. Deploying Your App Index

Setting up e-mail notices


In this recipe, we are going to use the previous work to trigger an event that will send e-mails. E-mails are a slow process sometimes, so I will put them in a queue. In this case, it will be a database queue since it is just local communication. Once we are done, we will see how to send a "nice" looking e-mail.

Getting ready

A base Laravel install will do. I will be working from the previous work, but you can follow along.

How to do it…

  1. First, let's make our queue database tables:

    > php artisan queue:table && php artisan migrate
    
  2. Then, let's set this to sync in our .env file. Make sure that the QUEUE_DRIVER variable in your .env file looks like the example here:

    Queue driver setting in .env

  3. In the .enf file, we will set MAIL to log until we are ready:

  4. Then, we will make the job:

    > php artisan make:job SendFavoritesEmail
    
  5. Let's just add a placeholder there for now, it is app/Jobs/SendFavoritesE-mail.php:

  6. Now, our handler will react to the queue, which I will...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image