Skip to content

Commit 3386e54

Browse files
authored
Merge pull request #179 from s-damian/master
Manage lang path for Laravel >= 9
2 parents fef6f53 + b9f9077 commit 3386e54

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/InvoiceServiceProvider.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,26 @@ protected function offerPublishing()
9090

9191
// Publishing the translation files.
9292
$this->publishes([
93-
__DIR__ . '/../resources/lang' => resource_path('lang/vendor/invoices'),
93+
__DIR__ . '/../resources/lang' => $this->getPublishableLangPath(),
9494
], 'invoices.translations');
9595
}
9696
}
9797

98+
private function getPublishableLangPath(): string
99+
{
100+
if (function_exists('lang_path')) {
101+
return lang_path('vendor/invoices');
102+
}
103+
104+
$splipVersion = explode('.', $this->app->version());
105+
106+
if ((int) $splipVersion[0] >= 9) {
107+
return base_path('lang/vendor/invoices');
108+
}
109+
110+
return base_path('resources/lang/vendor/invoices');
111+
}
112+
98113
/**
99114
* Register Invoices' services in the container.
100115
*

0 commit comments

Comments
 (0)