From cbbf41e6f6227ea40daba418c2488f6a3708cb89 Mon Sep 17 00:00:00 2001 From: Felix Lebel Date: Fri, 21 Apr 2017 14:59:48 -0400 Subject: [PATCH] Added strict mode --- src/MenuItem.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/MenuItem.php b/src/MenuItem.php index 55233c8..afc4a4f 100644 --- a/src/MenuItem.php +++ b/src/MenuItem.php @@ -93,6 +93,21 @@ public function makeTag($item) return null; } + /** + * Enabled strict mode (This means that query params are + * also evaluated). Full URL is then required to match. + * + * @param bool $strict + * + * @return $this + */ + public function strict(bool $strict = true) + { + $this->_items['__strict__'] = true; + + return $this; + } + /** * Checks if a sub-menu is active * @@ -159,7 +174,7 @@ public function active() return false; } - if ($this->url == request()->url()) { + if ($this->url == (isset($this->_items['__strict__']) && $this->_items['__strict__'] == true ? request()->fullUrl() : request()->url())) { return true; }