A kill switch—sometimes known as a https://en.wikipedia.org/wiki/Dead_man%27s_switch—is a type of safety mechanism common in machinery that interrupts a process in the event of an emergency. In this case, the drill trigger serves as a kill switch; if the operator becomes incapacitated, the drill will instantly stop (or be “killed”).
Here’s how we could implement this: class DeliveryRequest extends Model public function biker(): BelongsTo return $this->belongsTo(Biker::class); public function startBikerMatchFinder() $this->markAsFindingNearbyBikers(); NotifyBikers::dispatch($this); // This is a Kill Switch.
// public function handle() if ($this->deliveryRequest->hasEndedMatching()) { return; $this->deliveryRequest->markAsFindingAllBikers(); class NotifyBikers public function __construct(public DeliveryRequest $deliveryRequest)
This delivery app example shows us how we can apply our kill switch concept to activate a wider search for bikers.