Skip to content

Commit

Permalink
[9.x] Use Macroable in Session facade (#45310)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
karkowg committed Dec 14, 2022
1 parent 2c69244 commit 945c45e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Illuminate/Session/Store.php
Expand Up @@ -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.
*
Expand Down
4 changes: 4 additions & 0 deletions src/Illuminate/Support/Facades/Session.php
Expand Up @@ -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
*/
Expand Down

0 comments on commit 945c45e

Please sign in to comment.