Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9b899cf

Browse files
committed
Add work-around for Lumen
Fixesgeocoder-php#124
1 parent7881aa7 commit9b899cf

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

‎CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to[Semantic Versioning](http://semver.org/).
44

5+
##[4.0.8] - 25 Mar 2018
6+
###Added
7+
- work-around for missing`config_path()` function in Lumen.
8+
59
##[4.0.7] - 25 Mar 2018
610
###Added
711
- optional dedicated cache store.

‎src/Providers/GeocoderService.php‎

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,40 @@ class GeocoderService extends ServiceProvider
2121

2222
publicfunctionboot()
2323
{
24-
$configPath =__DIR__ .'/../../config/geocoder.php';
25-
$this->publishes([$configPath =>config_path('geocoder.php')],'config');
26-
$this->mergeConfigFrom($configPath,'geocoder');
27-
$this->app->singleton('geocoder',function () {
24+
$configPath =__DIR__ ."/../../config/geocoder.php";
25+
$this->publishes(
26+
[$configPath =>$this->configPath("geocoder.php")],
27+
"config"
28+
);
29+
$this->mergeConfigFrom($configPath,"geocoder");
30+
$this->app->singleton("geocoder",function () {
2831
return (newProviderAndDumperAggregator)
29-
->registerProvidersFromConfig(collect(config('geocoder.providers')));
32+
->registerProvidersFromConfig(collect(config("geocoder.providers")));
3033
});
3134
}
3235

3336
publicfunctionregister()
3437
{
35-
$this->app->alias('Geocoder', Geocoder::class);
38+
$this->app->alias("Geocoder", Geocoder::class);
3639
}
3740

3841
publicfunctionprovides() :array
3942
{
40-
return ['geocoder'];
43+
return ["geocoder"];
44+
}
45+
46+
protectedfunctionconfigPath(string$path ="") :string
47+
{
48+
if (function_exists("config_path")) {
49+
returnconfig_path($path);
50+
}
51+
52+
$pathParts = [
53+
app()->basePath(),
54+
"config",
55+
trim($path,"/"),
56+
];
57+
58+
returnimplode("/",$pathParts);
4159
}
4260
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp