Add update consolidado command and queuing
This commit is contained in:
@ -23,7 +23,7 @@ class Queue extends Model {
|
||||
$this->created = $fecha->format('Y-m-d H:i:s');
|
||||
return $this;
|
||||
}
|
||||
public function hasArguments() {
|
||||
public function hasArguments(): bool {
|
||||
return Model::factory(QueueArgument::class)
|
||||
->whereEqual('queue_id', $this->id)
|
||||
->groupBy('queue_id')
|
||||
@ -36,10 +36,25 @@ class Queue extends Model {
|
||||
}
|
||||
return $this->arguments;
|
||||
}
|
||||
public function isProcessed() {
|
||||
public function matchArguments(array $arguments): array {
|
||||
$args = $this->arguments();
|
||||
if ($args === null) {
|
||||
return [];
|
||||
}
|
||||
$matched = [];
|
||||
foreach ($arguments as $argument => $value) {
|
||||
foreach ($args as $arg) {
|
||||
if ($arg->argument == $argument and $arg->value == $value) {
|
||||
$matched []= $arg;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $matched;
|
||||
}
|
||||
public function isProcessed(): bool {
|
||||
return $this->processed > 0;
|
||||
}
|
||||
public function setProcessed(bool $processed) {
|
||||
public function setProcessed(bool $processed): Queue {
|
||||
$this->processed = $processed ? 1 : 0;
|
||||
return $this;
|
||||
}
|
||||
|
Reference in New Issue
Block a user