I have an abstract base class implements the laravel queueable trait:
abstract class BaseJob {
use Queueable;
}
Queueable defines $queue:
trait Queueable
{
public $queue;
}
In the actual job it is now possible to defined the classname as the queue name:
class SpecificJob extends BaseJob {
public $queue = self::class;
public function __construct($someParameter) {
// they all have custom constructors so they would overwrite the BaseJob constructor and I would also like to avoid calling parent::__construct;
}
}
Is there some way to do this in the baseclass so it is not required to do it in every class that extends from it?
I thought of something like this:
abstract class BaseJob {
use Queueable;
public $queue = static::class;
}
However this is not possible: 'static::' is not allowed in compile-time constants