Skip to content

Commit 9151004

Browse files
committed
config_path() helper does not exist in Lumen
Found these tiny helper function here: https://gist.github.com/mabasic/21d13eab12462e596120
1 parent 21d0b28 commit 9151004

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Console/Commands/MakeApiCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,15 @@ class MakeApiCommand extends Command
4242
*/
4343
protected $description = "Create a new JSON API configuration file";
4444

45+
public function configPath($filename)
46+
{
47+
if (function_exists('config_path')) {
48+
return config_path($filename);
49+
}
50+
51+
return app()->basePath() . '/config/' . $filename;
52+
}
53+
4554
/**
4655
* @param Filesystem $files
4756
* @return int
@@ -55,7 +64,7 @@ public function handle(Filesystem $files)
5564

5665
$filename = sprintf('json-api-%s.php', Str::dasherize($name));
5766

58-
if ($files->exists($path = config_path($filename))) {
67+
if ($files->exists($path = $this->configPath($filename))) {
5968
$this->error("JSON API '$name' already exists.");
6069
return 1;
6170
}

0 commit comments

Comments
 (0)