Skip to content

Commit

Permalink
Merge pull request #3 from hafijul233/develop
Browse files Browse the repository at this point in the history
helper class issue fixed
  • Loading branch information
hafijul233 authored Nov 19, 2021
2 parents c4add4e + f9ae69d commit e0d4db8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Database/Seeders/Rbac/PermissionSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Support\Facades\Route;
use Modules\Admin\Models\Rbac\Permission;
use Modules\Admin\Supports\Helper;
use Modules\Admin\Supports\Utility;

class PermissionSeeder extends Seeder
{
Expand All @@ -26,7 +27,7 @@ public function run()

foreach ($routes as $route) {
try {
Permission::create(['display_name' => Helper::permissionDisplay($route), 'name' => $route, 'guard_name' => 'web', 'enabled' => 'yes']);
Permission::create(['display_name' => Utility::permissionDisplay($route), 'name' => $route, 'guard_name' => 'web', 'enabled' => 'yes']);
} catch (\PDOException $exception) {
throw new \PDOException($exception->getMessage());
}
Expand Down
11 changes: 11 additions & 0 deletions Supports/Utility.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,15 @@ public static function formatLogFilename(string $filename)
return preg_replace('/laravel\-([\d]{4})-([\d]{2})-([\d]{2})\.log/', '$3/$2/$1', $filename);
}


/**
* Convert Route Name Human Readable Style
*
* @param string $permission
* @return string
*/
public static function permissionDisplay(string $permission): string
{
return ucwords(str_replace(['.', '-', '_'], [' ', ' ', ' '], $permission));
}
}

0 comments on commit e0d4db8

Please sign in to comment.