diff --git a/config/queue.php b/config/queue.php index 391304f36..ac96a88ff 100755 --- a/config/queue.php +++ b/config/queue.php @@ -79,6 +79,7 @@ return [ */ 'failed' => [ + 'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'), 'database' => env('DB_CONNECTION', 'mysql'), 'table' => 'failed_jobs', ], diff --git a/database/migrations/2022_03_15_160510_create_failed_jobs_table.php b/database/migrations/2022_03_15_160510_create_failed_jobs_table.php new file mode 100644 index 000000000..6aa6d743e --- /dev/null +++ b/database/migrations/2022_03_15_160510_create_failed_jobs_table.php @@ -0,0 +1,36 @@ +id(); + $table->string('uuid')->unique(); + $table->text('connection'); + $table->text('queue'); + $table->longText('payload'); + $table->longText('exception'); + $table->timestamp('failed_at')->useCurrent(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('failed_jobs'); + } +} diff --git a/packages/Webkul/Notification/src/Events/CreateOrderNotification.php b/packages/Webkul/Notification/src/Events/CreateOrderNotification.php index e587ea8b3..438b8d217 100644 --- a/packages/Webkul/Notification/src/Events/CreateOrderNotification.php +++ b/packages/Webkul/Notification/src/Events/CreateOrderNotification.php @@ -2,27 +2,16 @@ namespace Webkul\Notification\Events; -use Illuminate\Queue\SerializesModels; use Illuminate\Broadcasting\Channel; -use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; +use Illuminate\Foundation\Events\Dispatchable; +use Illuminate\Queue\SerializesModels; class CreateOrderNotification implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; - - /** - * Create a new event instance. - * - * @return void - */ - public function __construct() - { - - } - /** * Get the channels the event should broadcast on. * @@ -33,7 +22,13 @@ class CreateOrderNotification implements ShouldBroadcast return new Channel('notification'); } - + /** + * Seperate queue. + * + * Command: `php artisan queue:work --queue=broadcastable` + * + * @return string + */ public function broadcastQueue() { return 'broadcastable'; @@ -42,7 +37,7 @@ class CreateOrderNotification implements ShouldBroadcast /** * Get the channels the event should broadcast as. * - * @return broadcast name + * @return string */ public function broadcastAs() { diff --git a/packages/Webkul/Notification/src/Events/UpdateOrderNotification.php b/packages/Webkul/Notification/src/Events/UpdateOrderNotification.php index 6543def22..7d5a8a88b 100644 --- a/packages/Webkul/Notification/src/Events/UpdateOrderNotification.php +++ b/packages/Webkul/Notification/src/Events/UpdateOrderNotification.php @@ -2,11 +2,11 @@ namespace Webkul\Notification\Events; -use Illuminate\Queue\SerializesModels; use Illuminate\Broadcasting\Channel; -use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Broadcasting\InteractsWithSockets; use Illuminate\Contracts\Broadcasting\ShouldBroadcast; +use Illuminate\Foundation\Events\Dispatchable; +use Illuminate\Queue\SerializesModels; class UpdateOrderNotification implements ShouldBroadcast { @@ -34,7 +34,7 @@ class UpdateOrderNotification implements ShouldBroadcast return new Channel('notification'); } - /** + /** * Broadcast with data. * * @return array @@ -44,16 +44,25 @@ class UpdateOrderNotification implements ShouldBroadcast return $this->data; } - public function broadcastQueue () { + /** + * Seperate queue. + * + * Command: `php artisan queue:work --queue=broadcastable` + * + * @return string + */ + public function broadcastQueue() + { return 'broadcastable'; } /** * Get the channels the event should broadcast as. * - * @return broadcast name + * @return string */ - public function broadcastAs () { + public function broadcastAs() + { return 'update-notification'; } }