Skip to content

Commit e0ccbba

Browse files
authored
More descriptive messages on GateCollector (#1536)
1 parent 09653ad commit e0ccbba

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/DataCollector/GateCollector.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,19 @@ public function __construct(Gate $gate)
2727
});
2828
}
2929

30+
/**
31+
* {@inheritDoc}
32+
*/
33+
protected function customizeMessageHtml($messageHtml, $message)
34+
{
35+
$pos = strpos((string) $messageHtml, 'array:4');
36+
if ($pos !== false) {
37+
$messageHtml = substr_replace($messageHtml, $message['ability'], $pos, 7);
38+
}
39+
40+
return parent::customizeMessageHtml($messageHtml, $message);
41+
}
42+
3043
public function addCheck($user, $ability, $result, $arguments = [])
3144
{
3245
$userKey = 'user';

0 commit comments

Comments
 (0)