Skip to content

Commit

Permalink
Merge pull request #22 from mostafamaklad/v1.2
Browse files Browse the repository at this point in the history
PHP code sniffer issues
  • Loading branch information
mostafamaklad committed Sep 6, 2017
2 parents 912b033 + e22fb06 commit a730b07
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Exceptions/GuardDoesNotMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ class GuardDoesNotMatch extends InvalidArgumentException
{
public static function create(string $givenGuard, Collection $expectedGuards)
{
$message = new static("The given role or permission should use guard `{$expectedGuards->implode(', ')}` instead of `{$givenGuard}`.");
$expect = $expectedGuards->implode(', ');
$message = new static("The given role or permission should use guard `{$expect}` instead of `{$givenGuard}`.");

if (config('permission.log_registration_exception')) {
$logger = app('log');
$logger->alert($message);
}

return $message;
}
}
6 changes: 4 additions & 2 deletions src/Models/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ public static function create(array $attributes = [])
{
$attributes['guard_name'] = $attributes['guard_name'] ?? config('auth.defaults.guard');

if (static::getPermissions()->where('name', $attributes['name'])->where('guard_name',
$attributes['guard_name'])->first()) {
if (static::getPermissions()->where('name', $attributes['name'])->where(
'guard_name',
$attributes['guard_name']
)->first()) {
throw PermissionAlreadyExists::create($attributes['name'], $attributes['guard_name']);
}

Expand Down

0 comments on commit a730b07

Please sign in to comment.