Skip to content

Commit

Permalink
🐛 Fix Acorn registration when using Navi as a plugin (#71)
Browse files Browse the repository at this point in the history
Co-authored-by: Brandon <[email protected]>
  • Loading branch information
QWp6t and Log1x committed Mar 18, 2024
1 parent fe38c4c commit 83580d1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 27 deletions.
53 changes: 38 additions & 15 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
* Author URI: https://github.com/log1x
*/

if (! file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
return;
}

require_once $composer;

add_filter('after_setup_theme', function () {
if (file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
require_once $composer;
if (! function_exists('Roots\bootloader')) {
return;
}

if (function_exists('Roots\bootloader')) {
Roots\bootloader(function (Roots\Acorn\Application $app) {
$app->register(
Log1x\Navi\Providers\NaviServiceProvider::class
);
$app = Roots\bootloader()->getApplication();

Roots\Acorn\AliasLoader::getInstance([
'navi' => Log1x\Navi\Facades\Navi::class
])->register();
});
}
$app->register(Log1x\Navi\Providers\NaviServiceProvider::class);

$app->alias('navi', Log1x\Navi\Facades\Navi::class);
}, 20);

0 comments on commit 83580d1

Please sign in to comment.