Notification Fixed

This commit is contained in:
Devansh 2022-03-15 17:32:03 +05:30
parent c6471def2b
commit 3927800bce
4 changed files with 62 additions and 21 deletions

View File

@ -79,6 +79,7 @@ return [
*/
'failed' => [
'driver' => env('QUEUE_FAILED_DRIVER', 'database-uuids'),
'database' => env('DB_CONNECTION', 'mysql'),
'table' => 'failed_jobs',
],

View File

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateFailedJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->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');
}
}

View File

@ -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()
{

View File

@ -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';
}
}