定制 van-ons/laraberg-nova 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

van-ons/laraberg-nova

Composer 安装命令:

composer require van-ons/laraberg-nova

包简介

A Laravel Nova field.

README 文档

README

Social card of Laraberg Nova

Laraberg Nova

A Nova field for Laraberg.

Quick start

Requirements

Dependency Minimum version
PHP 8.1
Laravel Nova 4.35

Installation

Install via Composer:

composer require van-ons/laraberg-nova

Publish Laraberg files:

php artisan vendor:publish --provider="VanOns\Laraberg\LarabergServiceProvider"

Laraberg provides a CSS file that should be present on the page you want to render content on:

<link rel="stylesheet" href="{{ asset('vendor/laraberg/css/laraberg.css') }}">

Usage

Simply register the field in your Resource:

LarabergNova::make(__('Content'), 'content')

Add the RendersContent trait to your model. And optionally define the $contentColumn property to point to the column that holds your Laraberg content, this defaults to content.

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use VanOns\Laraberg\Traits\RendersContent;

class Post extends Model
{
    use HasFactory, RendersContent;

    protected $contentColumn = 'content';

    ...
}

Call the render method on your model in a template:

{!! $model->render() !!}

Options

The field has a few options you can configure.

Height

You can customize the height of the editor:

LarabergNova::make(__('Content'), 'content')->height(600)
Attachments

You can enable uploading attachments:

LarabergNova::make(__('Content'), 'content')->withFiles('public')

You will need to add the following migration to make this work:

Schema::create('laraberg_nova_pending_attachments', function (Blueprint $table) {
    $table->increments('id');
    $table->string('draft_id')->index();
    $table->string('attachment');
    $table->string('disk');
    $table->timestamps();
});

Schema::create('laraberg_nova_attachments', function (Blueprint $table) {
    $table->increments('id');
    $table->string('attachable_type');
    $table->unsignedInteger('attachable_id');
    $table->string('attachment');
    $table->string('disk');
    $table->string('url')->index();
    $table->timestamps();
    $table->index(['attachable_type', 'attachable_id']);
});

Contributing

Please see contributing for more information about how you can contribute.

Changelog

Please see changelog for more information about what has changed recently.

Upgrading

Please see upgrading for more information about how to upgrade.

Security

Please see security for more information about how we deal with security.

Credits

We would like to thank the following contributors for their contributions to this project:

License

The scripts and documentation in this project are released under the MIT License.

Logo of Van Ons

统计信息

  • 总下载量: 300
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 8
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固