Skip to content

Commit 2ef819d

Browse files
committed
Cleanup
1 parent 7f7662b commit 2ef819d

File tree

3 files changed

+8
-15
lines changed

3 files changed

+8
-15
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ composer require whitecube/laravel-prices
99

1010
## Configuration
1111

12-
You can publish the config file by running this command :
12+
You can publish the config file by running this command:
1313

1414
```shell
1515
php artisan vendor:publish --tag=prices-config
@@ -19,7 +19,6 @@ Once your configuration file is created in `config/prices.php`, you can edit the
1919

2020
```php
2121
return [
22-
// …
2322
'model' => \App\Models\CustomPriceModel::class,
2423
];
2524
```

src/HasPrices.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public function setPrice(
7070
DateTime $activated_at = null
7171
): static
7272
{
73-
$className= config('prices.model');
74-
$this->price = new $className($arguments, $amount, $minor, $currency, $type, $activated_at);
73+
$model = config('prices.model');
74+
$this->price = new $model($arguments, $amount, $minor, $currency, $type, $activated_at);
7575

7676
return $this;
7777
}

src/LaravelPricesServiceProvider.php

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,16 @@ public function boot()
1010
{
1111
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
1212

13-
if ($this->app->runningInConsole()) {
14-
$this->publishConfig();
15-
}
13+
$this->publishes([
14+
$this->getConfigPath() => config_path('prices.php')
15+
], 'prices-config');
1616

17-
if (!file_exists(config_path('prices.php'))) {
17+
if (! file_exists(config_path('prices.php'))) {
1818
$this->mergeConfigFrom($this->getConfigPath(), 'prices');
1919
}
2020
}
2121

22-
private function publishConfig()
23-
{
24-
$path = $this->getConfigPath();
25-
$this->publishes([$path => config_path('prices.php')], 'prices-config');
26-
}
27-
28-
private function getConfigPath()
22+
protected function getConfigPath(): string
2923
{
3024
return __DIR__ . '/../config/prices.php';
3125
}

0 commit comments

Comments
 (0)