承接 novius/laravel-nova-field-preview 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

novius/laravel-nova-field-preview

最新稳定版本:2.1.0

Composer 安装命令:

composer require novius/laravel-nova-field-preview

包简介

A Laravel Nova field for open front preview

README 文档

README

License: AGPL v3

Introduction

This package allows you to add Laravel Nova field to open the front preview url of a ressource.

Requirements

  • Laravel Nova >= 4.0
  • Laravel >= 10.0
  • Laravel >= 8.2

NOTE: These instructions are for Laravel >= 10.0 and PHP >= 8.2 If you are using prior version, please see the previous version's docs.

Installation

You can install the package via composer:

composer require novius/laravel-nova-field-preview

Add OpenPreview field on your Nova Resource.

If the resource have a previewUrl method :

use Laravel\Nova\Resource;
use Novius\LaravelNovaFieldPreview\Nova\Fields\OpenPreview;

class Post extends Resource
{
    protected function fields(): array
    {
        return [
            OpenPreview::make('Preview link'),

Otherwise you must specify the preview url :

use Laravel\Nova\Resource;
use Novius\LaravelNovaFieldPreview\Nova\Fields\OpenPreview;

class Post extends Resource
{
    protected function fields(): array
    {
        return [
            OpenPreview::make('Preview link')
            ->previewUrl(function() {
                // Return here the preview url of the resource
                return $this->resource->url().'.?preview=1';
            }),

Lang files

If you want to customize the lang files, you can publish them with:

php artisan vendor:publish --provider="Novius\LaravelNovaFieldPreview\LaravelNovaFieldPreviewServiceProvider" --tag="lang"

Lint

Lint your code with Laravel Pint using:

composer run-script lint

Licence

This package is under GNU Affero General Public License v3 or (at your option) any later version.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2023-06-23