Skip to content

Commit

Permalink
fixed reference to group exception
Browse files Browse the repository at this point in the history
  • Loading branch information
httpoz committed Oct 12, 2016
1 parent 6ed907c commit 3ed84d9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/HttpOz/Roles/Exceptions/GroupDeniedException.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php
namespace HttpOz\Roles\Exceptions;

class LevelDeniedException extends AccessDeniedException
class GroupDeniedException extends AccessDeniedException
{
/**
* Create a new group denied exception instance.
*
* @param string $level
* @param string $group
*/
public function __construct($level)
public function __construct($group)
{
$this->message = sprintf("You are not in the required [%s] group.", $level);
$this->message = sprintf("You are not in the required [%s] group.", $group);
}
}
10 changes: 5 additions & 5 deletions src/HttpOz/Roles/Middleware/VerifyGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ public function __construct(Guard $auth)
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param int $level
* @param int $group
* @return mixed
* @throws \HttpOz\Roles\Exceptions\LevelDeniedException
* @throws \HttpOz\Roles\Exceptions\GroupDeniedException
*/
public function handle($request, Closure $next, $level)
public function handle($request, Closure $next, $group)
{
if ($this->auth->check() && $this->auth->user()->group() >= $level) {
if ($this->auth->check() && $this->auth->user()->group() >= $group) {
return $next($request);
}
throw new GroupDeniedException($level);
throw new GroupDeniedException($group);
}
}
4 changes: 2 additions & 2 deletions src/config/roles.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
|--------------------------------------------------------------------------
|
| If you want, you can replace default models from this package by models
| you created. Have a look at `Bican\Roles\Models\Role` model and
| `Bican\Roles\Models\Permission` model.
| you created. Have a look at `HttpOz\Roles\Models\Role` model and
| `HttpOz\Roles\Models\Permission` model.
|
*/

Expand Down

0 comments on commit 3ed84d9

Please sign in to comment.