Skip to content

Commit

Permalink
Added strict mode
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDeadCode committed Apr 21, 2017
1 parent c5a2ccd commit cbbf41e
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit cbbf41e

Please sign in to comment.