mirror of
https://github.com/archtechx/tenancy.git
synced 2025-12-12 14:14:04 +00:00
28 lines
581 B
PHP
28 lines
581 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($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;
|
|
}
|
|
}
|
|
}
|