fixed stripe

This commit is contained in:
Edward Yang 2022-07-08 14:02:37 +08:00
parent bfb6db0be9
commit 0d051210b0
9 changed files with 35 additions and 5 deletions

View File

@ -92,6 +92,11 @@ class Plugin implements Arrayable, \ArrayAccess
}
public function getPath(): string
{
return $this->path;
}
public function getVersion(): string
{
return $this->version;

View File

@ -13,21 +13,23 @@ namespace Beike\Repositories;
use Beike\Models\Plugin;
use Beike\Plugin\Manager;
use Beike\Plugin\Plugin as BPlugin;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Http\File;
class PluginRepo
{
public static $installedPlugins;
/**
* 安装插件到系统: 插入数据
* @param $plugin
* @param BPlugin $bPlugin
*/
public static function installPlugin($plugin)
public static function installPlugin(BPlugin $bPlugin)
{
$type = $plugin->type;
$code = $plugin->code;
self::publishStaticFiles($bPlugin);
$type = $bPlugin->type;
$code = $bPlugin->code;
$plugin = Plugin::query()
->where('type', $type)
->where('code', $code)
@ -41,6 +43,21 @@ class PluginRepo
}
/**
* 发布静态资源到 public
* @param BPlugin $bPlugin
*/
public static function publishStaticFiles(BPlugin $bPlugin)
{
$code = $bPlugin->code;
$path = $bPlugin->getPath();
$staticPath = $path . DIRECTORY_SEPARATOR . 'static';
if (is_dir($staticPath)) {
\Illuminate\Support\Facades\File::copyDirectory($staticPath, public_path($code));
}
}
/**
* 从系统卸载插件: 删除数据
* @param $plugin

4
public/bk_stripe/css/demo.css vendored Normal file
View File

@ -0,0 +1,4 @@
/**
这里是插件css, 请在blade里面使用以下代码引入
<link rel="stylesheet" href="{{ asset('bk_stripe/css/demo.css') }}">
*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

4
public/bk_stripe/js/demo.js vendored Normal file
View File

@ -0,0 +1,4 @@
/**
* 这里是插件js, 请在blade里面使用以下代码引入
* <script src="{{ asset('bk_stripe/js/demo.js') }}"></script>
*/