承接 marcobax/nova-status-field 相关项目开发

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

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

marcobax/nova-status-field

Composer 安装命令:

composer require marcobax/nova-status-field

包简介

A Laravel Nova field for displaying statuses for Nova 4 and 5

README 文档

README

Nova Status Field

🚀 Compatible with Laravel Nova 4.0 & 5.0!

Package forked from wesselperik/nova-status-field to add support for Laravel Nova 5.0.

A Laravel Nova field for displaying a status icon, with optional tooltip and info text, on index and detail pages of your models. This package utilizes all icons from the Heroicons icon pack (from designer Steve Schroger), which is also used in Laravel Nova.

Installation

You can install the package using composer:

composer require marcobax/nova-status-field

Next up, add the field to your desired Nova model. See the example below:

// for example, in app/Nova/Blog.php

use MarcoBax\StatusField\StatusField;

// ...

public function fields(Request $request) {
    return [
        // Use a single value for tooltips and info...
        StatusField::make('Published')
            ->icons([
                'minus-circle' => $this->published == 0,
                'clock'        => $this->pending == 1 && $this->published == 0,
                'check-circle' => $this->pending == 0 && $this->published == 1
            ])
            ->color('primary') // optional
            ->solid(true) // optional
            ->tooltip($this->status) // optional
            ->info("Blog status: ".$this->status) // optional
            ->exceptOnForms()

        // ...or change text based on the value
        StatusField::make('Published')
            ->icons([
                'minus-circle' => $this->published == 0,
                'clock'        => $this->pending == 1 && $this->published == 0,
                'check-circle' => $this->pending == 0 && $this->published == 1
            ])
            ->tooltip([
                'minus-circle' => 'Not published',
                'clock'        => 'Pending publication',
                'check-circle' => 'Published'
            ])
            ->info([
                'minus-circle' => 'This blog is not published yet.',
                'clock'        => 'This blog is pending publication.',
                'check-circle' => 'This blog is published on '.$this->published_at->format('d-m-Y').'.'
            ])
            ->color([
                'minus-circle' => 'red-500',
                'clock'        => 'blue-500',
                'check-circle' => 'green-500'
            ])
            ->exceptOnForms()
    ];
}

Available icons are all Heroicons by Steve Schroger. By default, the icons are used in the outline style, but you can use the solid() function to change to the solid style (see the example above).

Available colors are the following TailwindCSS text colors included in Laravel Nova 4, which are:

  • primary
  • gray
  • white
  • blue
  • green
  • red

Contributors

License

The MIT License (MIT). Please see the license file for more information.

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 13
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-01-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固