Process assets of plugins
This commit is contained in:
parent
82ab3289db
commit
02b7c6158d
|
|
@ -121,6 +121,7 @@ class MarketController extends Controller
|
|||
if ($zip->extractTo($plugins_dir) === false) {
|
||||
return json(trans('admin.plugins.market.unzip-failed', ['error' => 'Unable to extract the file.']), 4);
|
||||
}
|
||||
$manager->copyPluginAssets(plugin($name));
|
||||
} else {
|
||||
return json(trans('admin.plugins.market.unzip-failed', ['error' => $res]), 4);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ class Plugin implements Arrayable, ArrayAccess
|
|||
|
||||
public function assets($relativeUri)
|
||||
{
|
||||
$baseUrl = config('plugins.url') ?: url('plugins');
|
||||
$baseUrl = config('plugins.url') ?: url('public/plugins');
|
||||
|
||||
return "$baseUrl/{$this->getDirname()}/$relativeUri";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,4 +355,19 @@ class PluginManager
|
|||
return config('plugins.directory') ?: base_path('plugins');
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy plugin assets
|
||||
*
|
||||
* @param Plugin $plugin
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function copyPluginAssets($plugin)
|
||||
{
|
||||
return $this->filesystem->copyDirectory(
|
||||
$this->getPluginsDir() . DIRECTORY_SEPARATOR . $plugin->name . DIRECTORY_SEPARATOR . 'assets',
|
||||
public_path('plugins/' . $plugin->name . '/assets')
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
1
public/.gitignore
vendored
1
public/.gitignore
vendored
|
|
@ -1,2 +1 @@
|
|||
app/
|
||||
plugins/
|
||||
|
|
|
|||
2
public/plugins/.gitignore
vendored
Normal file
2
public/plugins/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
*
|
||||
!.gitignore
|
||||
Loading…
Reference in New Issue
Block a user