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 208
208
],
209
209
'auth ' => [
210
210
'show_name ' => true , // Also show the users name/email in the debugbar
211
+ 'show_guards ' => true , // Show the guards that are used
211
212
],
212
213
'db ' => [
213
214
'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
25
25
/** @var bool */
26
26
protected $ showName = false ;
27
27
28
+ /** @var bool */
29
+ protected $ showGuardsData = true ;
30
+
28
31
/**
29
32
* @param \Illuminate\Auth\AuthManager $auth
30
33
* @param array $guards
@@ -44,6 +47,15 @@ public function setShowName($showName)
44
47
$ this ->showName = (bool ) $ showName ;
45
48
}
46
49
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
+
47
59
/**
48
60
* @{inheritDoc}
49
61
*/
@@ -79,6 +91,9 @@ public function collect()
79
91
}
80
92
81
93
$ data ['names ' ] = rtrim ($ names , ', ' );
94
+ if (!$ this ->showGuardsData ) {
95
+ unset($ data ['guards ' ]);
96
+ }
82
97
83
98
return $ data ;
84
99
}
@@ -142,14 +157,16 @@ public function getName()
142
157
*/
143
158
public function getWidgets ()
144
159
{
145
- $ widgets = [
146
- "auth " => [
160
+ $ widgets = [];
161
+
162
+ if ($ this ->showGuardsData ) {
163
+ $ widgets ["auth " ] = [
147
164
"icon " => "lock " ,
148
165
"widget " => "PhpDebugBar.Widgets.VariableListWidget " ,
149
166
"map " => "auth.guards " ,
150
- "default " => "{} "
151
- ]
152
- ];
167
+ "default " => "{} " ,
168
+ ];
169
+ }
153
170
154
171
if ($ this ->showName ) {
155
172
$ widgets ['auth.name ' ] = [
Original file line number Diff line number Diff line change @@ -492,6 +492,9 @@ public function __toString(): string
492
492
$ this ['auth ' ]->setShowName (
493
493
$ config ->get ('debugbar.options.auth.show_name ' )
494
494
);
495
+ $ this ['auth ' ]->setShowGuardsData (
496
+ $ config ->get ('debugbar.options.auth.show_guards ' , true )
497
+ );
495
498
} catch (Exception $ e ) {
496
499
$ this ->addCollectorException ('Cannot add AuthCollector ' , $ e );
497
500
}
You can’t perform that action at this time.
0 commit comments