Skip to content

Commit

Permalink
config_path() helper does not exist in Lumen
Browse files Browse the repository at this point in the history
  • Loading branch information
jelhan committed May 24, 2017
1 parent 21d0b28 commit 9151004
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Console/Commands/MakeApiCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ class MakeApiCommand extends Command
*/
protected $description = "Create a new JSON API configuration file";

public function configPath($filename)
{
if (function_exists('config_path')) {
return config_path($filename);
}

return app()->basePath() . '/config/' . $filename;
}

/**
* @param Filesystem $files
* @return int
Expand All @@ -55,7 +64,7 @@ public function handle(Filesystem $files)

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

if ($files->exists($path = config_path($filename))) {
if ($files->exists($path = $this->configPath($filename))) {
$this->error("JSON API '$name' already exists.");
return 1;
}
Expand Down

0 comments on commit 9151004

Please sign in to comment.