Skip to content

SpinyMan/laravel-will-queue

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

laravel-will-queue

Latest Version on Packagist Software License Total Downloads

This package gives you ability to change notification type (instant or via queue) dynamically.

Install

Via Composer

$ composer require spinyman/laravel-will-queue

Usage

  1. First of all you have to deimplement ShouldQueue interface from all notification models:

    class EmailNotification extends Notification implements ShouldQueue

  2. Make changes in User model:

    use Illuminate\Notifications\Notifiable;

    use SpinyMan\WillQueue\Notifiable;

    use SpinyMan\WillQueue\Notifiable;
    
    class User extends Authenticatable {
    	use Notifiable;
    	...
    }
  3. somewhere use notify function with second optional bool param to indicate queue (true) or instant (false) notification (default: false):

    $user = User::find(1);
    $user->notify(new EmailNotification() [, true|false]);

    OR if you are really sure to notify using queue:

    $user = User::find(1);
    $user->notifyFromQueue(new EmailNotification());

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages