diff --git a/src/Actions/SaveRoute.php b/src/Actions/SaveRoute.php index b10c119..b343618 100644 --- a/src/Actions/SaveRoute.php +++ b/src/Actions/SaveRoute.php @@ -24,23 +24,20 @@ public function __construct(Request $request, RouteMatched $route = null) public function dispatch() { - app()->terminating($this->dispatchAfterTerminating()); - } - - public function dispatchAfterTerminating() - { - if(!$this->shouldRequestBeStored()) { - return false; - } + app()->terminating(function() { + if(!$this->shouldRequestBeStored()) { + return false; + } - $this->checkExpiredLogs(); + $this->checkExpiredLogs(); - $createdRoute = $this->createRoute(); - if($createdRoute) { - $this->triggerNotifications($createdRoute); - } + $createdRoute = $this->createRoute(); + if($createdRoute) { + $this->triggerNotifications($createdRoute); + } - return true; + return true; + }); } public function shouldRequestBeStored()