Skip to content

Commit d9eaa21

Browse files
committed
feat: add flash messaging to request
1 parent d05393a commit d9eaa21

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/Request.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,17 @@ public static function cookies(?string $key = null)
332332
Cookie::get($key);
333333
}
334334

335+
/**
336+
* Display a flash message from the previous request
337+
*
338+
* @param string|null $key The key to get from the flash data
339+
* @return array|string|null
340+
*/
341+
public static function flash(?string $key = null)
342+
{
343+
return \Leaf\Flash::display($key);
344+
}
345+
335346
/**
336347
* Does the Request body contain parsed form data?
337348
* @return bool
@@ -340,7 +351,7 @@ public static function isFormData(): bool
340351
{
341352
$method = static::getMethod();
342353

343-
return ($method === static::METHOD_POST && is_null(static::getContentType())) || in_array(static::getMediaType(), static::$formDataMediaTypes);
354+
return ($method === static::METHOD_POST && static::getContentType() === null) || in_array(static::getMediaType(), static::$formDataMediaTypes);
344355
}
345356

346357
/**

0 commit comments

Comments
 (0)