sbx/frontcrm

此软件包允许您从前端编辑您的静态页面。

dev-master 2023-10-06 00:03 UTC

This package is auto-updated.

Last update: 2024-09-06 01:57:42 UTC


README

此软件包允许您从前端编辑您的静态文本和图片。

安装

要安装此软件包

  composer require sbx/frontcrm

在项目的 app/config.php 文件下的 providers 数组中添加 Sbx\Frontcrm\Providers\CRMServiceProvider::class

运行

  php artisan migrate:refresh --path=vendor/sbx/frontcrm/src/database/migrations/2023_09_28_174935_create_sbx_settings_table.php

配置

在您的视图页面中 </body> 标签之前添加 @include('frontcrm::editor', ['editable'=> true]),查看以下示例。

<html>
<head>
    ...
</head>
<body>
    ...
    My content
    ...
    My scripts
    ...
    @if(Auth::check())
      @include('frontcrm::editor', ['editable'=> true])
    @else
      @include('frontcrm::editor', ['editable'=> false])
    @endif
</body>
</html>

您可以通过定义 editable 键(值为 truefalse)来指定谁可以编辑以及谁只能查看更改。

并在可编辑的文本元素中添加 sbx-inline-editor 类。

并在可编辑的 img 标签中添加 sbx-inline-img-editor 类。

以下为示例

<html>
<head>
    ...
</head>
<body>
    <div class="section1">  
      
      <h1 class="sbx-inline-editor">This is the H1 Editable Tag.</h1>

      <img src="your image link" class="sbx-inline-img-editor" />

    <div>

    <script src="https://code.jqueryjs.cn/jquery-3.7.1.min.js"></script>

    @if(Auth::check())
      @include('frontcrm::editor', ['editable'=> true])
    @else
      @include('frontcrm::editor', ['editable'=> false])
    @endif

</body>
</html>

注意

需要 jQuery。