-
Notifications
You must be signed in to change notification settings - Fork 6
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
Should we support controlling listener and notification behaviors with ShouldAssumeFresh?
<?php
namespace App\Listeners;
use App\Events\PostCreated as PostCreatedEvent;
use App\Notifications\PostCreated as PostCreatedNotification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Mpyw\LaravelCachedDatabaseStickiness\Jobs\ShouldAssumeFresh;
class NotifyPostCreated implements ShouldQueue, ShouldAssumeFresh
{
use InteractsWithQueue, SerializesModels;
public function handle(PostCreatedEvent $event): void
{
$event->post->community->users->each->notify(new PostCreatedNotification($event->post));
}
}<?php
namespace App\Notifications;
use App\Post;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use Mpyw\LaravelCachedDatabaseStickiness\Jobs\ShouldAssumeFresh;
class PostCreated extends Notification implements ShouldQueue, ShouldAssumeFresh
{
protected $post;
public function __construct(Post $post)
{
$this->post = $post;
}
/* ... */
}It is probably possible to support them. However, it seems almost useless in most cases...
ucan-lab
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested