From 621c4400c585198e74b8210de081e5d1a8a4cd52 Mon Sep 17 00:00:00 2001 From: IsharaEkanayaka Date: Sun, 14 Jul 2024 08:24:40 +0530 Subject: [PATCH] remove news_editor,event_editor roles in boilerplate config --- config/boilerplate.php | 2 -- database/seeders/Auth/UserRoleSeeder.php | 4 ++-- resources/views/backend/includes/sidebar.blade.php | 4 ++-- tests/TestCase.php | 4 ++-- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/config/boilerplate.php b/config/boilerplate.php index e31855e..baff4ef 100644 --- a/config/boilerplate.php +++ b/config/boilerplate.php @@ -97,8 +97,6 @@ * It is not recommended to change */ 'admin' => 'Administrator', - 'news_editor' => 'News Editor', - 'event_editor' => 'Event Editor', ], ], diff --git a/database/seeders/Auth/UserRoleSeeder.php b/database/seeders/Auth/UserRoleSeeder.php index cd8eed8..262f540 100644 --- a/database/seeders/Auth/UserRoleSeeder.php +++ b/database/seeders/Auth/UserRoleSeeder.php @@ -21,8 +21,8 @@ public function run() $this->disableForeignKeys(); User::find(1)->assignRole(config('boilerplate.access.role.admin')); - User::find(3)->assignRole(config('boilerplate.access.role.news_editor')); - User::find(4)->assignRole(config('boilerplate.access.role.event_editor')); + User::find(3)->assignRole('News Editor'); + User::find(4)->assignRole('Event Editor'); $this->enableForeignKeys(); } diff --git a/resources/views/backend/includes/sidebar.blade.php b/resources/views/backend/includes/sidebar.blade.php index 60f59ea..d1e9030 100644 --- a/resources/views/backend/includes/sidebar.blade.php +++ b/resources/views/backend/includes/sidebar.blade.php @@ -84,7 +84,7 @@ class="c-sidebar-nav-dropdown {{ activeClass(Route::is('admin.auth.user.*') || R @endif - @if ($logged_in_user->can('admin.access.news.edit')) + @if ($logged_in_user->hasPermissionTo('admin.access.news.edit')) {{-- News --}}
  • admin()->create(['name' => 'news_editor']); + $user = User::factory()->admin()->create(['name' => 'News Editor']); $user->assignRole($newsEditorRole->name); $this->actingAs($user); @@ -62,7 +62,7 @@ protected function loginAsNewsEditor() protected function loginAsEventEditor() { $EventEditorRole = Role::find(3); - $user = User::factory()->admin()->create(['name' => 'event_editor']); + $user = User::factory()->admin()->create(['name' => 'Event Editor']); $user->assignRole($EventEditorRole->name); $this->actingAs($user);