From 945c45e5a5c6f4f72b84f1be9788797dc7fb2b5c Mon Sep 17 00:00:00 2001 From: Gustavo Karkow <14905932+karkowg@users.noreply.github.com> Date: Wed, 14 Dec 2022 11:03:04 -0500 Subject: [PATCH] [9.x] Use Macroable in Session facade (#45310) * Use Macroable in Session Store I found myself wanting to add a macro to encapsulate a session getter I was using in a few different places but noticed the Session facade is not using the Macroable trait like other facades do. Do you see any issues with just importing the Macroable trait directly in the Session class? * update docblock for Session facade --- src/Illuminate/Session/Store.php | 3 +++ src/Illuminate/Support/Facades/Session.php | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/Illuminate/Session/Store.php b/src/Illuminate/Session/Store.php index e803499ca77d..b78b54c8499d 100755 --- a/src/Illuminate/Session/Store.php +++ b/src/Illuminate/Session/Store.php @@ -7,12 +7,15 @@ use Illuminate\Support\Arr; use Illuminate\Support\MessageBag; use Illuminate\Support\Str; +use Illuminate\Support\Traits\Macroable; use Illuminate\Support\ViewErrorBag; use SessionHandlerInterface; use stdClass; class Store implements Session { + use Macroable; + /** * The session ID. * diff --git a/src/Illuminate/Support/Facades/Session.php b/src/Illuminate/Support/Facades/Session.php index 17078418b145..a36f61334d2a 100755 --- a/src/Illuminate/Support/Facades/Session.php +++ b/src/Illuminate/Support/Facades/Session.php @@ -59,6 +59,10 @@ * @method static void setHandler(\SessionHandlerInterface $handler) * @method static bool handlerNeedsRequest() * @method static void setRequestOnHandler(\Illuminate\Http\Request $request) + * @method static void macro(string $name, object|callable $macro) + * @method static void mixin(object $mixin, bool $replace = true) + * @method static bool hasMacro(string $name) + * @method static void flushMacros() * * @see \Illuminate\Session\SessionManager */