als antwoord op
For anyone who's reading along: if you just want to define a job and do it / trigger it somewhere else in your code, you can use Kirby's triggers:
kirby()->hook('my.action', function($name, $message) {
echo 'hi ' . $name . ', ' . $message;
});
// and elsewhere:
kirby()->trigger('my.action', ['Seb', 'how are you?']);
Or take a look at Kirby 3's new Events:
use Kirby\Events\Events;
// the class with the events trait
class MyClass {
use Events;
}
// create the event
MyClass::on('say', function($message) {
echo $message;
});
// trigger the event
MyClass::trigger('say', 'hello');