Skip to content

Commit ebccdac

Browse files
authored
Export gate arguments to save time
1 parent 209974a commit ebccdac

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/DataCollector/GateCollector.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,22 @@
55
use DebugBar\DataCollector\MessagesCollector;
66
use Illuminate\Contracts\Auth\Access\Gate;
77
use Illuminate\Contracts\Auth\Authenticatable;
8+
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
89

910
/**
1011
* Collector for Laravel's Auth provider
1112
*/
1213
class GateCollector extends MessagesCollector
1314
{
15+
/** @var ValueExporter */
16+
protected $exporter;
1417
/**
1518
* @param Gate $gate
1619
*/
1720
public function __construct(Gate $gate)
1821
{
1922
parent::__construct('gate');
23+
$this->exporter = new ValueExporter();
2024

2125
if (method_exists($gate, 'after')) {
2226
$gate->after([$this, 'addCheck']);
@@ -31,7 +35,7 @@ public function addCheck(Authenticatable $user, $ability, $result, $arguments =
3135
'ability' => $ability,
3236
'result' => $result,
3337
'user' => $user->getAuthIdentifier(),
34-
'arguments' => $arguments,
38+
'arguments' => $this->exporter->exportValue($arguments),
3539
], $label, false);
3640
}
3741
}

0 commit comments

Comments
 (0)