Skip to content

Commit 83580d1

Browse files
QWp6tLog1x
andauthored
🐛 Fix Acorn registration when using Navi as a plugin (#71)
Co-authored-by: Brandon <[email protected]>
1 parent fe38c4c commit 83580d1

File tree

2 files changed

+50
-27
lines changed

2 files changed

+50
-27
lines changed

composer.lock

+38-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

plugin.php

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@
99
* Author URI: https://github.com/log1x
1010
*/
1111

12+
if (! file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
13+
return;
14+
}
15+
16+
require_once $composer;
17+
1218
add_filter('after_setup_theme', function () {
13-
if (file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
14-
require_once $composer;
19+
if (! function_exists('Roots\bootloader')) {
20+
return;
1521
}
1622

17-
if (function_exists('Roots\bootloader')) {
18-
Roots\bootloader(function (Roots\Acorn\Application $app) {
19-
$app->register(
20-
Log1x\Navi\Providers\NaviServiceProvider::class
21-
);
23+
$app = Roots\bootloader()->getApplication();
2224

23-
Roots\Acorn\AliasLoader::getInstance([
24-
'navi' => Log1x\Navi\Facades\Navi::class
25-
])->register();
26-
});
27-
}
25+
$app->register(Log1x\Navi\Providers\NaviServiceProvider::class);
26+
27+
$app->alias('navi', Log1x\Navi\Facades\Navi::class);
2828
}, 20);

0 commit comments

Comments
 (0)