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.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners