I've needed to stop or delete a job myself in the past and kinda went down a rabbit hole trying to see if it was possible, but i think there's a better way to think about it. Instead of trying to cancel or stop the job from running. Just make the job do nothing if a certain condition is met.
In your example with a "Register" add a new column to your register table called status where you can set the status to be active or cancelled etc.
If a user decides the register isn't needed anymore. Let them delete / cancel it, but then update the status column to be = cancelled.
And then in your job code have a check for the status. If its set to cancelled, just return early.
public function handle()
{
// First check if register has been cancelled
if ($this->register->status == 'cancelled') {
return false;
}
// Continue with whatever your job does.
$this->register->user->notify();
So the job still runs, but it never executes any of the logic inside of it if the cancelled condition is met. This to me is a much simpler way of "cancelling" a job.
I got this idea from the https://learn-laravel-queues.com/ Ebook by Mohamed Said - Ex Laravel employee. Its well worth the money if you want to level up your queue knowledge.
Hope this helps you out!