9
9
use Imdhemy \Purchases \ServiceProviders \LiapServiceProvider ;
10
10
11
11
/**
12
- * Config publish command.
13
- *
14
- * This command is used to publish LIAP configuration file
12
+ * This command is used to publish LIAP configuration file.
15
13
*/
16
14
class LiapConfigPublishCommand extends Command
17
15
{
18
- /**
19
- * @const string The failure message to display if file is already published
20
- */
21
16
public const MESSAGE_ALREADY_INSTALLED = 'liap.php is already published. ' ;
22
-
23
- /**
24
- * @const string The success message to display if file is published successfully
25
- */
26
17
public const MESSAGE_SUCCESS = 'liap.php published successfully ' ;
27
18
28
19
protected $ signature = 'liap:config:publish {--f|force} ' ;
29
20
30
21
protected $ description = 'Publishes the LIAP configuration file. ' ;
31
22
32
- /**
33
- * Executes the console command.
34
- */
35
23
public function handle (): int
36
24
{
37
25
if ($ this ->shouldForce ()) {
38
26
return $ this ->publishConfig (true );
39
27
}
40
28
41
29
if ($ this ->isInstalled ()) {
42
- return $ this ->fail ();
30
+ return $ this ->publishFailed ();
43
31
}
44
32
45
33
return $ this ->publishConfig ();
@@ -53,9 +41,6 @@ private function shouldForce(): bool
53
41
return (bool )$ this ->option ('force ' );
54
42
}
55
43
56
- /**
57
- * Publish configurations.
58
- */
59
44
private function publishConfig (bool $ force = false ): int
60
45
{
61
46
$ params = [
@@ -73,18 +58,12 @@ private function publishConfig(bool $force = false): int
73
58
return $ result ;
74
59
}
75
60
76
- /**
77
- * Check if the freya is installed.
78
- */
79
61
private function isInstalled (): bool
80
62
{
81
63
return File::exists (config_path (LiapServiceProvider::CONFIG_KEY .'.php ' ));
82
64
}
83
65
84
- /**
85
- * Should run on command failure.
86
- */
87
- private function fail (): int
66
+ private function publishFailed (): int
88
67
{
89
68
$ this ->error (self ::MESSAGE_ALREADY_INSTALLED );
90
69
0 commit comments