Skip to content

Commit

Permalink
add if function
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Feb 9, 2017
1 parent 28f3b84 commit 14c6afa
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# Changelog

All Notable changes to `menu` will be documented in this file.
All notable changes to `menu` will be documented in this file.

## 2.2.0 - 2017-02-09
- Added: `if` function

## 2.1.3
- Fixed setting an active url when the url is exactly the same
- Fixed: setting an active url when the url is exactly the same

## 2.1.1
- Added: The request root path when setting the active path
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The MIT License (MIT)

Copyright (c) 2017 Spatie bvba <info@spatie.be>
Copyright (c) Spatie bvba <info@spatie.be>

> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 11 additions & 0 deletions src/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,17 @@ public function setItemParentAttribute(string $attribute, string $value = '')
return $this;
}

/**
* @param bool $condition
* @param callable $callable
*
* @return $this
*/
public function if(bool $condition, callable $callable)
{
return $condition ? $callable($this) : $this;
}

/**
* Create a empty blueprint of the menu (copies `filters` and `activeClass`).
*
Expand Down

0 comments on commit 14c6afa

Please sign in to comment.