diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php
index 40120d94..652eb6c4 100644
--- a/app/Providers/AppServiceProvider.php
+++ b/app/Providers/AppServiceProvider.php
@@ -35,6 +35,7 @@ class AppServiceProvider extends ServiceProvider
'base_url' => url('/'),
'site_name' => option_localized('site_name'),
'route' => request()->path(),
+ 'extra' => [],
]);
$event->addContent('');
diff --git a/app/Services/Hook.php b/app/Services/Hook.php
index 5743cce0..07a0937b 100644
--- a/app/Services/Hook.php
+++ b/app/Services/Hook.php
@@ -71,12 +71,12 @@ class Hook
// We will determine current locale in the event callback,
// otherwise the locale is not properly detected.
- $basepath = plugin($id)->getPath().'/';
+ $basepath = config('plugins.url') ?: url('plugins').'/'.$id.'/';
$relative = 'lang/'.config('app.locale').'/locale.js';
- if (file_exists($basepath.$relative)) {
- $event->addContent('');
- }
+ $event->addContent(
+ ''
+ );
return;
}
diff --git a/app/Services/Plugin.php b/app/Services/Plugin.php
index 81c13187..aeeaec19 100644
--- a/app/Services/Plugin.php
+++ b/app/Services/Plugin.php
@@ -89,14 +89,6 @@ class Plugin implements Arrayable, ArrayAccess
return isset($this->{$name}) || $this->packageInfoAttribute(snake_case($name, '-'));
}
- /**
- * Dot notation getter for composer.json attributes.
- *
- * @see https://laravel.com/docs/5.1/helpers#arrays
- *
- * @param $name
- * @return mixed
- */
public function packageInfoAttribute($name)
{
return Arr::get($this->packageInfo, $name);
@@ -104,9 +96,9 @@ class Plugin implements Arrayable, ArrayAccess
public function assets($relativeUri)
{
- $baseUrl = config('plugins.url') ?: url('public/plugins');
+ $baseUrl = config('plugins.url') ?: url('plugins');
- return "$baseUrl/{$this->getDirname()}/$relativeUri";
+ return "$baseUrl/{$this->getDirname()}/assets/$relativeUri";
}
/**
diff --git a/app/Services/PluginManager.php b/app/Services/PluginManager.php
index e240d4c3..320f960e 100644
--- a/app/Services/PluginManager.php
+++ b/app/Services/PluginManager.php
@@ -99,7 +99,7 @@ class PluginManager
// Instantiates an Plugin object using the package path and package.json file.
$plugin = new Plugin($this->getPluginsDir().DIRECTORY_SEPARATOR.$dirname, $package);
- // Per default all plugins are installed if they are registered in composer.
+ // Each default all plugins are installed if they are registered in composer.
$plugin->setDirname($dirname);
$plugin->setInstalled(true);
$plugin->setNameSpace(Arr::get($package, 'namespace'));
@@ -164,6 +164,8 @@ class PluginManager
$plugin->setEnabled(true);
+ $this->copyPluginAssets($plugin);
+
$this->dispatcher->dispatch(new Events\PluginWasEnabled($plugin));
}
}
@@ -414,12 +416,16 @@ class PluginManager
*/
public function copyPluginAssets($plugin)
{
- $dir = public_path('plugins/'.$plugin->name.'/assets');
+ $dir = public_path('plugins/'.$plugin->name);
Storage::deleteDirectory($dir);
- return $this->filesystem->copyDirectory(
+ $this->filesystem->copyDirectory(
$this->getPluginsDir().DIRECTORY_SEPARATOR.$plugin->name.DIRECTORY_SEPARATOR.'assets',
- $dir
+ $dir.'/assets'
+ );
+ $this->filesystem->copyDirectory(
+ $this->getPluginsDir().DIRECTORY_SEPARATOR.$plugin->name.DIRECTORY_SEPARATOR.'lang',
+ $dir.'/lang'
);
}