Skip to content

Commit 1807cd2

Browse files
committed
fix message console
1 parent 4c16656 commit 1807cd2

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/Commands/MakeRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function createRepositoryInterface(string $className)
8383

8484
$repositoryInterfacePath = $this->getRepositoryInterfacePath($className);
8585
if (file_exists($repositoryInterfacePath)) {
86-
$this->line("<warning>file $className repository interface already exist:</warning> {$repositoryInterfaceName}");
86+
$this->error("file $className repository interface already exist: {$repositoryInterfaceName}");
8787
return ;
8888
}
8989

@@ -92,7 +92,7 @@ public function createRepositoryInterface(string $className)
9292
$repositoryInterfacePath,
9393
__DIR__ . "/stubs/repository-interface.stub"
9494
);
95-
95+
$this->info("Repository created successfully");
9696
$this->line("<info>Created $className repository interface:</info> " . $repositoryInterfaceName);
9797

9898
return $repositoryInterfaceNamespace . "\\" . $className;
@@ -119,7 +119,7 @@ public function createRepository(string $className, $isDefault = true)
119119
$stubName = $isDefault ? "eloquent-repository.stub" : "custom-repository.stub";
120120
$repositoryPath = $this->getRepositoryPath($className, $isDefault);
121121
if (file_exists($repositoryPath)) {
122-
$this->line("<warning>file $className repository already exist:</warning> {$repositoryName}");
122+
$this->error("file $className repository already exist: {$repositoryName}");
123123
return ;
124124
}
125125
new CreateFile(

src/Commands/MakeService.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,20 @@ public function handle()
4343
*/
4444
public function createService(string $className)
4545
{
46-
$nameOfService = $this->getServiceName($className);
47-
$serviceName = $nameOfService . config("easy-repository.service_suffix");
46+
$serviceName = $className . config("easy-repository.service_suffix");
4847

4948
$namespace = $this->getNameSpace($className);
5049
$stubProperties = [
5150
"{namespace}" => $namespace,
5251
"{serviceName}" => $serviceName,
53-
"{serviceInterface}" => $nameOfService. config("easy-repository.service_interface_suffix"),
54-
"{repositoryInterfaceName}" => $this->getRepositoryInterfaceName($nameOfService),
55-
"{repositoryInterfaceNamespace}" => $this->getRepositoryInterfaceNamespace($nameOfService),
52+
"{serviceInterface}" => $className. config("easy-repository.service_interface_suffix"),
53+
"{repositoryInterfaceName}" => $this->getRepositoryInterfaceName($className),
54+
"{repositoryInterfaceNamespace}" => $this->getRepositoryInterfaceNamespace($className),
5655
];
5756
// check file exist
58-
$filePath = $this->getServicePath($className, $nameOfService);
57+
$filePath = $this->getServicePath($className);
5958
if (file_exists($filePath)) {
60-
$this->line("<warning>file $className service already exist:</warning> {$serviceName}");
59+
$this->error("file $className service already exist: {$serviceName}");
6160
return ;
6261
}
6362

@@ -96,7 +95,7 @@ public function createServiceInterface(string $className)
9695
// check folder exist
9796
$interfacePath = $this->getServiceInterfacePath($className,$serviceName);
9897
if (file_exists($interfacePath)) {
99-
$this->line("<warning>file $className service interface already exist:</warning> {$serviceName}");
98+
$this->error("file $className service interface already exist: {$serviceName}");
10099
return ;
101100
}
102101
// create file
@@ -105,6 +104,7 @@ public function createServiceInterface(string $className)
105104
$interfacePath,
106105
__DIR__ . "/stubs/service-interface.stub"
107106
);
107+
$this->info("Service generated successfully");
108108
$this->line("<info>Created $className service interface:</info> {$serviceName}");
109109
}
110110

@@ -113,11 +113,11 @@ public function createServiceInterface(string $className)
113113
*
114114
* @return string
115115
*/
116-
private function getServicePath($className, $servicename)
116+
private function getServicePath($className)
117117
{
118118
return $this->appPath() . "/" .
119119
config("easy-repository.service_directory") .
120-
"/$className". "/$servicename" . config("easy-repository.service_suffix") .".php";
120+
"/$className". "/$className" . config("easy-repository.service_suffix") .".php";
121121
}
122122

123123
/**

0 commit comments

Comments
 (0)