Only reflash flashed items.

This commit is contained in:
Taylor Otwell 2011-11-07 13:48:08 -06:00
parent e8561ca905
commit 285a744fac
1 changed files with 11 additions and 3 deletions

View File

@ -155,7 +155,17 @@ public static function flash($key, $value)
*/ */
public static function reflash() public static function reflash()
{ {
static::keep(array_keys(static::$session['data'])); $flash = array();
foreach (static::$session['data'] as $key => $value)
{
if (strpos($key, ':old:') === 0)
{
$flash[] = str_replace(':old:', '', $key);
}
}
static::keep($flash);
} }
/** /**
@ -168,8 +178,6 @@ public static function keep($keys)
{ {
foreach ((array) $keys as $key) foreach ((array) $keys as $key)
{ {
$key = str_replace(array(':old:', ':new:'), '', $key);
static::flash($key, static::get($key)); static::flash($key, static::get($key));
} }
} }