Skip to content

Commit c7753c1

Browse files
committed
feat: add middleware data
1 parent 8f3b9d4 commit c7753c1

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/Request.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ class Request
2525
const METHOD_OPTIONS = 'OPTIONS';
2626
const METHOD_OVERRIDE = '_METHOD';
2727

28-
/**
29-
* @var array
30-
*/
31-
protected static $formDataMediaTypes = ['application/x-www-form-urlencoded'];
3228
protected static $errors = [];
29+
protected static $formDataMediaTypes = ['application/x-www-form-urlencoded'];
3330

3431
/**
3532
* Get HTTP method
@@ -353,6 +350,18 @@ public static function user()
353350
return static::auth()->user();
354351
}
355352

353+
/**
354+
* Get data passed from the previous middleware
355+
*
356+
* @param string|null $key The key to get from the middleware data
357+
*/
358+
public static function next($key = null)
359+
{
360+
$middlewareData = \Leaf\Config::getStatic('middleware.data');
361+
362+
return $key ? $middlewareData[$key] : $middlewareData;
363+
}
364+
356365
/**
357366
* Store a file from the request.
358367
*

0 commit comments

Comments
 (0)