Skip to content

Commit

Permalink
Refactor: Use DIRECTORY_SEPARATOR in Page Generation
Browse files Browse the repository at this point in the history
  • Loading branch information
coolsam726 committed Apr 19, 2024
1 parent 3dad95c commit f58e7e3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Commands/ModuleMakeFilamentPageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function handle(): int
->trim('/')
->trim('\\')
->trim(' ')
->replace('/', '\\');
->replace(DIRECTORY_SEPARATOR, '\\');
$pageClass = (string) str($page)->afterLast('\\');
$pageNamespace = str($page)->contains('\\') ?
(string) str($page)->beforeLast('\\') :
Expand Down Expand Up @@ -86,7 +86,7 @@ public function handle(): int
->trim('/')
->trim('\\')
->trim(' ')
->replace('/', '\\');
->replace(DIRECTORY_SEPARATOR, '\\');

if (! str($resource)->endsWith('Resource')) {
$resource .= 'Resource';
Expand Down Expand Up @@ -229,17 +229,17 @@ public function handle(): int
->implode('.'))->prepend($module->getLowerName() . '::');

$path = (string) str($page)
->prepend('/')
->prepend(DIRECTORY_SEPARATOR)
->prepend(empty($resource) ? $path : $resourcePath . "\\{$resource}\\Pages\\")
->replace('\\', '/')
->replace('//', '/')
->replace('\\', DIRECTORY_SEPARATOR)
->replace('//', DIRECTORY_SEPARATOR)
->append('.php');

$viewPath = $module->resourcesPath(
(string) str($view)
->replace($module->getLowerName() . '::', '')
->replace('.', '/')
->prepend('views/')
->replace('.', DIRECTORY_SEPARATOR)
->prepend('views'.DIRECTORY_SEPARATOR)
->append('.blade.php'),
);

Expand Down

0 comments on commit f58e7e3

Please sign in to comment.