Skip to content

Commit

Permalink
fix: php artisan vendor:publish command not working in Laravel appl…
Browse files Browse the repository at this point in the history
…ication (#600)

fix #599
  • Loading branch information
nick-lai authored Jul 22, 2024
1 parent 9b01a63 commit 71a2531
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ $profile = \LINEMessagingApi::pushMessage(....);
Facade uses `\GuzzleHttp\Client` by default. If you want to change the config, run

```bash
$ php artisan vendor:publish --tag=config
$ php artisan vendor:publish --provider="LINE\Laravel\LINEBotServiceProvider" --tag=config
```

Then `line-bot.php` will be published to `config/` dir.
Expand Down
23 changes: 22 additions & 1 deletion src/laravel/lib/LINEBotServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ class LINEBotServiceProvider extends \Illuminate\Support\ServiceProvider
],
];

private const CONFIG_PATH = __DIR__ . '/config/line-bot.php';

/**
* Bootstrap any package services.
*
* @return void
*/
public function boot()
{
if ($this->app->runningInConsole()) {
$this->publishes(
paths: [
self::CONFIG_PATH => config_path('line-bot.php'),
],
groups: [
'config',
],
);
}
}

/**
* Register bindings in the container.
*
Expand All @@ -61,7 +82,7 @@ class LINEBotServiceProvider extends \Illuminate\Support\ServiceProvider
public function register()
{
$this->mergeConfigFrom(
__DIR__ . '/config/line-bot.php',
self::CONFIG_PATH,
'line-bot'
);
$this->app->bind('line-bot-http-client', function () {
Expand Down

0 comments on commit 71a2531

Please sign in to comment.