AsyncCall
Laraquick\Jobs\AsyncCall
This class reduces the necessity of creating several job classes. It allows you to queue a call to a method.
<?php
use Laraquick\Jobs\AsyncCall;
class Task {
public function notifyUsers () {
// fetch users and notify them
}
public static function deleteFinished($condition1, $condition2) {
// find finsished tasks and delete them.
}
}
// get a task from some where
$task = Task::find(3);
AsyncCall::dispatch([$task, 'notifyUsers']]);
// call static method and pass in parameters
AsyncCall::dispatch([Task::class, 'deleteFinished'], [$condition1, $condition2]);
Updated over 6 years ago
Next