1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 18:04:03 +00:00
tenancy/src/Listeners/QueueableListener.php
2022-09-29 22:20:55 +02:00

28 lines
588 B
PHP

<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Listeners;
use Illuminate\Contracts\Queue\ShouldQueue;
/**
* @method handle(object $event)
*/
abstract class QueueableListener implements ShouldQueue
{
public static bool $shouldQueue = false;
public function shouldQueue(object $event): bool
{
if (static::$shouldQueue) {
return true;
} else {
// The listener is not queued so we manually
// pass the event to the handle() method.
$this->handle($event);
return false;
}
}
}