From 6b573133932ec2ee17a3dc56bfaf82b5a3cfbf15 Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Sun, 25 Sep 2016 19:46:57 +0100 Subject: [PATCH 1/3] Updating composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 0260f53..8f3b9d4 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "require": { "php": ">=5.6.4", "arcanedev/gravatar": "~1.0", - "arcanedev/laravel-auth": "~0.13", + "arcanedev/laravel-auth": "~0.14", "arcanesoft/core": "~1.0" }, "require-dev": { From e997aa7dfc062854f292340e833ad1c2ddf06c4c Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Sun, 25 Sep 2016 19:47:20 +0100 Subject: [PATCH 2/3] Updating config file --- config/auth.php | 30 ++++++++++++++++-------------- src/Seeds/RolesSeeder.php | 14 +++++++++++++- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/config/auth.php b/config/auth.php index 9e696a1..c9a91ef 100644 --- a/config/auth.php +++ b/config/auth.php @@ -62,27 +62,31 @@ | ------------------------------------------------------------------------------------------------ */ 'users' => [ - 'table' => 'users', - 'model' => Arcanesoft\Auth\Models\User::class, - 'observer' => Arcanesoft\Auth\Observers\UserObserver::class, + 'table' => 'users', + 'model' => Arcanesoft\Auth\Models\User::class, + 'observer' => Arcanesoft\Auth\Observers\UserObserver::class, + 'slug-separator' => '.', ], 'roles' => [ - 'table' => 'roles', - 'model' => Arcanesoft\Auth\Models\Role::class, - 'observer' => Arcanesoft\Auth\Observers\RoleObserver::class, + 'table' => 'roles', + 'model' => Arcanesoft\Auth\Models\Role::class, + 'observer' => Arcanesoft\Auth\Observers\RoleObserver::class, + 'slug-separator' => '-', ], 'permissions-groups' => [ - 'table' => 'permissions_groups', - 'model' => Arcanesoft\Auth\Models\PermissionsGroup::class, - 'observer' => Arcanesoft\Auth\Observers\PermissionsGroupObserver::class, + 'table' => 'permissions_groups', + 'model' => Arcanesoft\Auth\Models\PermissionsGroup::class, + 'observer' => Arcanesoft\Auth\Observers\PermissionsGroupObserver::class, + 'slug-separator' => '-', ], 'permissions' => [ - 'table' => 'permissions', - 'model' => Arcanesoft\Auth\Models\Permission::class, - 'observer' => Arcanesoft\Auth\Observers\PermissionObserver::class, + 'table' => 'permissions', + 'model' => Arcanesoft\Auth\Models\Permission::class, + 'observer' => Arcanesoft\Auth\Observers\PermissionObserver::class, + 'slug-separator' => '.', ], /* ------------------------------------------------------------------------------------------------ @@ -122,6 +126,4 @@ | ------------------------------------------------------------------------------------------------ */ 'use-observers' => true, - - 'slug-separator' => '.', ]; diff --git a/src/Seeds/RolesSeeder.php b/src/Seeds/RolesSeeder.php index 7a09f19..625acc0 100644 --- a/src/Seeds/RolesSeeder.php +++ b/src/Seeds/RolesSeeder.php @@ -48,7 +48,7 @@ protected function prepareRoles(array $roles) $now = Carbon::now(); foreach ($roles as $key => $role) { - $roles[$key]['slug'] = Str::slug($role['name'], config('arcanesoft.auth.slug-separator', '.')); + $roles[$key]['slug'] = $this->slugify($role['name']); $roles[$key]['is_active'] = isset($role['is_active']) ? $role['is_active'] : true; $roles[$key]['is_locked'] = isset($role['is_locked']) ? $role['is_locked'] : true; $roles[$key]['created_at'] = $now; @@ -69,4 +69,16 @@ protected function syncAdminRole() Permission::all()->pluck('id')->toArray() ); } + + /** + * Slugify the value. + * + * @param string $value + * + * @return string + */ + protected function slugify($value) + { + return Str::slug($value, config('arcanesoft.auth.roles.slug-separator', '-')); + } } From 736ccc8190513a88bf09d7395aaa7fc176ab3cbf Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Sun, 25 Sep 2016 19:47:30 +0100 Subject: [PATCH 3/3] Minor fixes --- src/Providers/PackagesServiceProvider.php | 3 ++- src/Seeds/Foundation/PermissionTableSeeder.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Providers/PackagesServiceProvider.php b/src/Providers/PackagesServiceProvider.php index 4bc8702..522a7b5 100644 --- a/src/Providers/PackagesServiceProvider.php +++ b/src/Providers/PackagesServiceProvider.php @@ -3,6 +3,7 @@ use Arcanedev\Gravatar\GravatarServiceProvider; use Arcanedev\LaravelAuth\LaravelAuthServiceProvider; use Arcanedev\Support\ServiceProvider; +use Illuminate\Support\Arr; /** * Class PackagesServiceProvider @@ -62,7 +63,7 @@ private function configLaravelAuthPackage() $config->set('auth.model', $config->get('arcanesoft.auth.users.model', \Arcanesoft\Auth\Models\User::class)); $config->set('auth.table', $config->get('arcanesoft.auth.users.table', 'users')); - $config->set('laravel-auth', array_except($config->get('arcanesoft.auth'), ['route', 'hasher'])); + $config->set('laravel-auth', Arr::except($config->get('arcanesoft.auth'), ['route', 'hasher'])); } /** diff --git a/src/Seeds/Foundation/PermissionTableSeeder.php b/src/Seeds/Foundation/PermissionTableSeeder.php index fc1bfe5..d504eff 100644 --- a/src/Seeds/Foundation/PermissionTableSeeder.php +++ b/src/Seeds/Foundation/PermissionTableSeeder.php @@ -150,7 +150,7 @@ private function getOtherSeeds() 'name' => 'Dashboard - View the dashboard stats', 'description' => 'Allow to view a auth stats.', 'slug' => 'auth.dashboard.stats', - ] + ], ]; } }