Skip to content

Commit

Permalink
Merge pull request #55 from mostafamaklad/v1.7
Browse files Browse the repository at this point in the history
V1.7.1
  • Loading branch information
mostafamaklad committed Apr 7, 2018
2 parents 9683593 + e206f6f commit d37e741
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ The MIT License (MIT). Please see [License File](LICENSE.md) for more informatio

[link-packagist]: https://packagist.org/packages/mostafamaklad/laravel-permission-mongodb
[ico-version]: https://img.shields.io/packagist/v/mostafamaklad/laravel-permission-mongodb.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-license]: https://img.shields.io/packagist/l/mostafamaklad/laravel-permission-mongodb.svg?style=flat-square
[ico-downloads]: https://img.shields.io/packagist/dt/mostafamaklad/laravel-permission-mongodb.svg?style=flat-square

[link-laravel-5.2]: https://laravel.com/docs/5.2
Expand Down
3 changes: 3 additions & 0 deletions src/Guard.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ public function getNames($model) : Collection
}
return collect(config('auth.guards'))
->map(function ($guard) {
if (! isset($guard['provider'])) {
return;
}
return config("auth.providers.{$guard['provider']}.model");
})
->filter(function ($model) use ($class) {
Expand Down
8 changes: 4 additions & 4 deletions src/Traits/HasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function scopePermission(Builder $query, $permissions): Builder
*
* @param array|string|Role ...$roles
*
* @return $this
* @return array|Role|string
*/
public function assignRole(...$roles)
{
Expand All @@ -108,15 +108,15 @@ public function assignRole(...$roles)

$this->forgetCachedPermissions();

return $this;
return $roles;
}

/**
* Revoke the given role from the model.
*
* @param array|string|Role ...$roles
*
* @return HasRoles
* @return array|Role|string
*/
public function removeRole(...$roles)
{
Expand All @@ -131,7 +131,7 @@ public function removeRole(...$roles)

$this->forgetCachedPermissions();

return $this;
return $roles;
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/MultipleGuardsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ protected function getEnvironmentSetUp($app)
$app['config']->set('auth.guards', [
'web' => ['driver' => 'session', 'provider' => 'users'],
'api' => ['driver' => 'jwt', 'provider' => 'users'],
'abc' => ['driver' => 'abc'],
]);
}
}

0 comments on commit d37e741

Please sign in to comment.