From b7966907f30436dccc7270db997a49663b454b86 Mon Sep 17 00:00:00 2001 From: Andrew Schmelyun Date: Thu, 23 Jan 2020 13:30:37 -0500 Subject: [PATCH] Reconfigures app terminating as closure internally, fixes #59 --- src/Actions/SaveRoute.php | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) 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()