naykel/gotime

NayKel Laravel 应用程序的入门包

v0.17.0 2024-01-21 08:12 UTC

README

Total Downloads Latest Stable Version License

NAYKEL Gotime

NayKel Laravel 应用程序的入门包。

安装

要开始使用,请使用 Composer 包管理器安装 Gotime

composer require naykel/gotime

接下来,使用 gotime:install 命令安装 Gotime 资源

php artisan gotime:install

配置文件在包注册时会合并,但您可以选择发布 naykel.php 配置文件。

php artisan vendor:publish --tag=gotime-config

已知问题

此驱动程序不支持创建临时 URL。

https://laracasts.com/discuss/channels/livewire/pdf-passes-image-validation?page=1&replyId=806087

livewire/livewire#3133 (评论)

if (! $this->isPreviewable()) {
    // show a missing image icon (?) for files that cannot be previewed
    return 'data:image/png;base64...gg-1.5==';
}

挂载资源或创建空白模型

根据路由,Livewire 组件将挂载资源并使用路由模型绑定设置 $editing,或者从 $initialValues 数组设置初始值以创建一个新空白模型。

添加主图像

$tmpImage 变量在特质中设置,因为不需要手动使用它。 ??

图像参数

  1. 设置 $disk 或留空以使用 public ????

在特质中定义的属性可以在主组件的 mount() 方法中重置或覆盖

我艰难学到的经验教训

不要定义一个文件数据类型为 string 的变量。为什么?它是一个文件,而不是字符串!

CkEditor

<div wire:ignore class="frm-row">
    <textarea wire:model.blur="editing.description" name="editing.description" id="ckeditor"></textarea>
</div>

@push('scripts')
<script src="https://cdn.ckeditor.com/ckeditor5/27.1.0/classic/ckeditor.js"></script>
<script>
    ClassicEditor
        .create(document.querySelector('#ckeditor'))
        .then(editor => {
            editor.model.document.on('change:data', () => {
                @this.set('editing.description', editor.getData());
            })
        })
        .catch(error => {
            console.error(error);
        });
</script>

@endpush

添加新图标

  1. 更新扩展 svgblade.php
find ./resources/views/components/icon -name "*.svg" -type f -exec bash -c 'mv -- "$0" "${0%.svg}.blade.php"' {} \;
  1. 添加 $attributeswidthheight
# DON'T RUN THIS WITH EXPORTED FIGMA ICONS, IT WILL ADD THE ATTRIBUTES TWICE
find ./resources/views/components/v2/icon -type f -name "*.blade.php" -exec sed -i 's/<svg xmlns="http:\/\/www\.w3\.org\/2000\/svg"/<svg {{ $attributes }} xmlns="http:\/\/www\.w3\.org\/2000\/svg" width="24" height="24"/g' {} +
# FOR FIGMA ICONS
find ./resources/views/components/icon/other -type f -name "*.blade.php" -exec sed -i 's/<svg xmlns="http:\/\/www\.w3\.org\/2000\/svg"/<svg {{ $attributes }} xmlns="http:\/\/www\.w3\.org\/2000\/svg"/g' {} +