Skip to content

Commit 945c45e

Browse files
authored
[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
1 parent 2c69244 commit 945c45e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/Illuminate/Session/Store.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,15 @@
77
use Illuminate\Support\Arr;
88
use Illuminate\Support\MessageBag;
99
use Illuminate\Support\Str;
10+
use Illuminate\Support\Traits\Macroable;
1011
use Illuminate\Support\ViewErrorBag;
1112
use SessionHandlerInterface;
1213
use stdClass;
1314

1415
class Store implements Session
1516
{
17+
use Macroable;
18+
1619
/**
1720
* The session ID.
1821
*

src/Illuminate/Support/Facades/Session.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
* @method static void setHandler(\SessionHandlerInterface $handler)
6060
* @method static bool handlerNeedsRequest()
6161
* @method static void setRequestOnHandler(\Illuminate\Http\Request $request)
62+
* @method static void macro(string $name, object|callable $macro)
63+
* @method static void mixin(object $mixin, bool $replace = true)
64+
* @method static bool hasMacro(string $name)
65+
* @method static void flushMacros()
6266
*
6367
* @see \Illuminate\Session\SessionManager
6468
*/

0 commit comments

Comments
 (0)