Skip to content

Commit

Permalink
Remove the "isNot" alias on the HasRoles trait
Browse files Browse the repository at this point in the history
Laravel (in 5.4.31) added its own "isNot" method to the base Eloquent
Model class. Pull: laravel/framework#20354
So we unfortunately have to remove our alias, which fixes #187.
  • Loading branch information
victoroloyede committed Aug 3, 2017
1 parent 6c16c5d commit c38fbb6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
16 changes: 0 additions & 16 deletions src/Database/Concerns/HasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,22 +109,6 @@ public function isNotA($role)
return call_user_func_array([$this, 'isNotAn'], func_get_args());
}

/**
* Check if the model has none of the given roles.
*
* Alias for the "isNotAn" method.
*
* @param string $role
* @return bool
*/
public function isNot($role)
{
return call_user_func_array(
[$this, 'isNotAn'],
func_get_args()
);
}

/**
* Check if the model has all of the given roles.
*
Expand Down
3 changes: 0 additions & 3 deletions tests/HasRolesAndAbilitiesTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ public function test_can_check_roles()
$this->assertFalse($user->isAn('admin'));

$this->assertTrue($user->isNotA('admin'));
$this->assertTrue($user->isNot('admin'));
$this->assertFalse($user->isA('admin'));

$user->assign('admin');
Expand All @@ -160,14 +159,12 @@ public function test_can_check_multiple_roles()
{
$gate = $this->gate($user = User::create());

$this->assertTrue($user->isNot('admin', 'editor'));
$this->assertFalse($user->isAn('admin', 'editor'));

$user->assign('moderator');
$user->assign('editor');

$this->assertTrue($user->isAn('admin', 'moderator'));
$this->assertFalse($user->isNot('admin', 'moderator'));
$this->assertTrue($user->isAll('editor', 'moderator'));
$this->assertFalse($user->isAll('moderator', 'admin'));
}
Expand Down

0 comments on commit c38fbb6

Please sign in to comment.