File tree Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Expand file tree Collapse file tree 3 files changed +26
-5
lines changed Original file line number Diff line number Diff line change 208208 ],
209209 'auth ' => [
210210 'show_name ' => true , // Also show the users name/email in the debugbar
211+ 'show_guards ' => true , // Show the guards that are used
211212 ],
212213 'db ' => [
213214 'with_params ' => true , // Render SQL with the parameters substituted
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class MultiAuthCollector extends DataCollector implements Renderable
2525 /** @var bool */
2626 protected $ showName = false ;
2727
28+ /** @var bool */
29+ protected $ showGuardsData = true ;
30+
2831 /**
2932 * @param \Illuminate\Auth\AuthManager $auth
3033 * @param array $guards
@@ -44,6 +47,15 @@ public function setShowName($showName)
4447 $ this ->showName = (bool ) $ showName ;
4548 }
4649
50+ /**
51+ * Set to hide the guards tab, and show only name
52+ * @param bool $showGuardsData
53+ */
54+ public function setShowGuardsData ($ showGuardsData )
55+ {
56+ $ this ->showGuardsData = (bool ) $ showGuardsData ;
57+ }
58+
4759 /**
4860 * @{inheritDoc}
4961 */
@@ -79,6 +91,9 @@ public function collect()
7991 }
8092
8193 $ data ['names ' ] = rtrim ($ names , ', ' );
94+ if (!$ this ->showGuardsData ) {
95+ unset($ data ['guards ' ]);
96+ }
8297
8398 return $ data ;
8499 }
@@ -142,14 +157,16 @@ public function getName()
142157 */
143158 public function getWidgets ()
144159 {
145- $ widgets = [
146- "auth " => [
160+ $ widgets = [];
161+
162+ if ($ this ->showGuardsData ) {
163+ $ widgets ["auth " ] = [
147164 "icon " => "lock " ,
148165 "widget " => "PhpDebugBar.Widgets.VariableListWidget " ,
149166 "map " => "auth.guards " ,
150- "default " => "{} "
151- ]
152- ];
167+ "default " => "{} " ,
168+ ];
169+ }
153170
154171 if ($ this ->showName ) {
155172 $ widgets ['auth.name ' ] = [
Original file line number Diff line number Diff line change @@ -492,6 +492,9 @@ public function __toString(): string
492492 $ this ['auth ' ]->setShowName (
493493 $ config ->get ('debugbar.options.auth.show_name ' )
494494 );
495+ $ this ['auth ' ]->setShowGuardsData (
496+ $ config ->get ('debugbar.options.auth.show_guards ' , true )
497+ );
495498 } catch (Exception $ e ) {
496499 $ this ->addCollectorException ('Cannot add AuthCollector ' , $ e );
497500 }
You can’t perform that action at this time.
0 commit comments