Skip to content

Commit c38fbb6

Browse files
committed
Remove the "isNot" alias on the HasRoles trait
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.
1 parent 6c16c5d commit c38fbb6

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

src/Database/Concerns/HasRoles.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,6 @@ public function isNotA($role)
109109
return call_user_func_array([$this, 'isNotAn'], func_get_args());
110110
}
111111

112-
/**
113-
* Check if the model has none of the given roles.
114-
*
115-
* Alias for the "isNotAn" method.
116-
*
117-
* @param string $role
118-
* @return bool
119-
*/
120-
public function isNot($role)
121-
{
122-
return call_user_func_array(
123-
[$this, 'isNotAn'],
124-
func_get_args()
125-
);
126-
}
127-
128112
/**
129113
* Check if the model has all of the given roles.
130114
*

tests/HasRolesAndAbilitiesTraitTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ public function test_can_check_roles()
145145
$this->assertFalse($user->isAn('admin'));
146146

147147
$this->assertTrue($user->isNotA('admin'));
148-
$this->assertTrue($user->isNot('admin'));
149148
$this->assertFalse($user->isA('admin'));
150149

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

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

166164
$user->assign('moderator');
167165
$user->assign('editor');
168166

169167
$this->assertTrue($user->isAn('admin', 'moderator'));
170-
$this->assertFalse($user->isNot('admin', 'moderator'));
171168
$this->assertTrue($user->isAll('editor', 'moderator'));
172169
$this->assertFalse($user->isAll('moderator', 'admin'));
173170
}

0 commit comments

Comments
 (0)