Skip to content

Commit

Permalink
Allow to use nullable user (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
mnabialek authored and barryvdh committed Feb 7, 2018
1 parent b5d1df3 commit f0018d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/DataCollector/GateCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public function __construct(Gate $gate)
$gate->after([$this, 'addCheck']);
}

public function addCheck(Authorizable $user, $ability, $result, $arguments = [])
public function addCheck(Authorizable $user = null, $ability, $result, $arguments = [])
{
$label = $result ? 'success' : 'error';

$this->addMessage([
'ability' => $ability,
'result' => $result,
snake_case(class_basename($user)) => $user->id,
($user ? snake_case(class_basename($user)) : 'user') => ($user ? $user->id : null),
'arguments' => $this->exporter->cloneVar($arguments),
], $label, false);
}
Expand Down

0 comments on commit f0018d3

Please sign in to comment.