diff --git a/.travis.yml b/.travis.yml index 37f5119..a165347 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,12 +3,12 @@ language: php dist: trusty php: - - 7.1.3 + - 7.2 matrix: fast_finish: true allow_failures: - - php: 7.1.3 + - php: 7.2 before_script: - travis_retry composer self-update diff --git a/composer.json b/composer.json index 31d2bc2..a8592a2 100644 --- a/composer.json +++ b/composer.json @@ -11,14 +11,14 @@ }], "minimum-stability": "dev", "require": { - "php": ">=7.1.3", - "illuminate/support": "~5.0", - "illuminate/cache": "~5.0" + "php": "^7.2", + "illuminate/support": "~6.0", + "illuminate/cache": "~6.0" }, "require-dev": { - "orchestra/database": "~3.8.0", - "orchestra/testbench": "~3.8.0", - "phpunit/phpunit": "~7.0" + "orchestra/database": "^4.0", + "orchestra/testbench": "^4.0", + "phpunit/phpunit": "~8.0" }, "autoload": { "psr-4": { diff --git a/database/factories/ModelFactory.php b/database/factories/ModelFactory.php index 05ae286..4593ad0 100644 --- a/database/factories/ModelFactory.php +++ b/database/factories/ModelFactory.php @@ -12,6 +12,9 @@ */ /** @var \Illuminate\Database\Eloquent\Factory $factory */ + +use Illuminate\Support\Str; + $factory->define( \HttpOz\Roles\Tests\Stubs\User::class, function ( Faker\Generator $faker ) { static $password; @@ -19,7 +22,7 @@ 'name' => $faker->name, 'email' => $faker->unique()->safeEmail, 'password' => $password ?: $password = bcrypt( 'secret' ), - 'remember_token' => str_random( 10 ), + 'remember_token' => Str::random( 10 ), ]; } ); diff --git a/readme.md b/readme.md index dde8bf9..01712d7 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# Roles for Laravel 5.3 to 5.8 +# Roles for Laravel 5 / 6 Powerful package for handling roles in Laravel [![Build Status](https://travis-ci.org/httpoz/roles.svg)](https://travis-ci.org/httpoz/roles) @@ -15,10 +15,11 @@ Powerful package for handling roles in Laravel | 5.5.* | [Roles 3.0.x](https://github.com/httpoz/roles/tree/3.0) | | 5.6.* | [Roles 3.1.x](https://github.com/httpoz/roles/tree/v3.1.0) | | 5.7.* | [Roles 3.2.x](https://github.com/httpoz/roles/tree/3.2.0) | -| 5.8.* | Roles 3.3.x +| 5.8.* | [Roles 3.3.x](https://github.com/httpoz/roles/tree/3.3.0) | +| 6.x | Roles 4.x #### History -This project was largely inspired by Roman's [romanbican/roles](https://github.com/romanbican/roles/) Laravel package. However at the time Laravel 5.3 was released his package was not actively maintained. I have ommitted permissions in this package in favour of Laravel's [Authorization](https://laravel.com/docs/5.3/authorization). I intend to keep this package as simple and minimal as is possible. +This project was largely inspired by Roman's [romanbican/roles](https://github.com/romanbican/roles/) Laravel package. However at the time Laravel 5.3 was released his package was not actively maintained. I have ommitted permissions in this package in favour of Laravel's [Authorization](https://laravel.com/docs/6.x/authorization). I intend to keep this package as simple and minimal as is possible. - [Installation](#installation) - [Composer](#composer) @@ -43,7 +44,7 @@ This package is very easy to set up. There are only couple of steps. ### Composer Add the package to your project via composer. ```bash -composer require httpoz/roles:~v3.3.0 +composer require httpoz/roles:^v4.0 ``` ### Config File And Migrations diff --git a/src/Traits/HasRole.php b/src/Traits/HasRole.php index 5a40728..301b04f 100644 --- a/src/Traits/HasRole.php +++ b/src/Traits/HasRole.php @@ -235,8 +235,8 @@ private function getArrayFrom( $argument ) { * @return mixed */ public function __call( $method, $parameters ) { - if ( starts_with( $method, 'is' ) ) { - return $this->isRole( snake_case( substr( $method, 2 ), config( 'roles.separator' ) ) ); + if ( Str::startsWith( $method, 'is' ) ) { + return $this->isRole( Str::snake( substr( $method, 2 ), config( 'roles.separator' ) ) ); } return parent::__call( $method, $parameters ); diff --git a/src/Traits/Sluggable.php b/src/Traits/Sluggable.php index 4edc607..91e3845 100644 --- a/src/Traits/Sluggable.php +++ b/src/Traits/Sluggable.php @@ -2,6 +2,8 @@ namespace HttpOz\Roles\Traits; +use Illuminate\Support\Str; + trait Sluggable { /** @@ -13,12 +15,12 @@ trait Sluggable public function setSlugAttribute($value) { - $this->attributes['slug'] = str_slug($value, config('roles.separator')); + $this->attributes['slug'] = Str::slug($value, config('roles.separator')); } public function setGroupAttribute($value) { - $this->attributes['group'] = str_slug($value, config('roles.separator')); + $this->attributes['group'] = Str::slug($value, config('roles.separator')); } }