Skip to content
This repository has been archived by the owner on Mar 18, 2022. It is now read-only.

Commit

Permalink
Merge pull request #68 from lucasmichot/feature/str
Browse files Browse the repository at this point in the history
Directly Str class instead of the helper
  • Loading branch information
romanbican committed Jun 22, 2015
2 parents 808e2aa + db7aefe commit e227519
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/Bican/Roles/Traits/HasRoleAndPermission.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Bican\Roles\Traits;

use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Model;

trait HasRoleAndPermission
Expand Down Expand Up @@ -99,7 +100,7 @@ protected function isAll(array $roles)
protected function hasRole($role)
{
return $this->getRoles()->contains(function ($key, $value) use ($role) {
return $role == $value->id || str_is($role, $value->slug);
return $role == $value->id || Str::is($role, $value->slug);
});
}

Expand Down Expand Up @@ -240,7 +241,7 @@ protected function canAll(array $permissions)
protected function hasPermission($permission)
{
return $this->getPermissions()->contains(function ($key, $value) use ($permission) {
return $permission == $value->id || str_is($permission, $value->slug);
return $permission == $value->id || Str::is($permission, $value->slug);
});
}

Expand Down
4 changes: 3 additions & 1 deletion src/Bican/Roles/Traits/Slugable.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Bican\Roles\Traits;

use Illuminate\Support\Str;

trait Slugable
{
/**
Expand All @@ -12,6 +14,6 @@ trait Slugable
*/
public function setSlugAttribute($value)
{
$this->attributes['slug'] = str_slug($value, config('roles.separator'));
$this->attributes['slug'] = Str::slug($value, config('roles.separator'));
}
}

0 comments on commit e227519

Please sign in to comment.