Commit 2ef32608 authored by Taylor Otwell's avatar Taylor Otwell

Allow multiple items to be passed to Session::has.

parent f48d76ab
...@@ -68,16 +68,24 @@ class Session { ...@@ -68,16 +68,24 @@ class Session {
} }
/** /**
* Determine if the session or flash data contains an item. * Determine if the session or flash data contains an item or set of items.
* *
* @param string $key * @param string $key
* @return bool * @return bool
*/ */
public static function has($key) public static function has($key)
{ {
return array_key_exists($key, static::$session['data']) or foreach (func_get_args() as $key)
array_key_exists(':old:'.$key, static::$session['data']) or {
array_key_exists(':new:'.$key, static::$session['data']); if ( ! array_key_exists($key, static::$session['data']) and
! array_key_exists(':old:'.$key, static::$session['data']) and
! array_key_exists(':new:'.$key, static::$session['data']))
{
return false;
}
}
return true;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment