承接 tomhatzer/nova-business-hours 相关项目开发

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

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

tomhatzer/nova-business-hours

Composer 安装命令:

composer require tomhatzer/nova-business-hours

包简介

Business hours field for Laravel Nova.

README 文档

README

This package offers a field for Nova to easily manage your business hours.

Install

composer require tomhatzer/nova-business-hours

Usage

Add this line to your Nova resource fields array:

NovaBusinessHours::make('Business hours', 'business_hours'),

Compatibility

Using this package with spatie/open-hours

Create a getter for your business hours field in your model like this:

public function getBusinessHoursAttribute($value)
{
    $jsonDecoded = json_decode($value);

    return collect($jsonDecoded)->transform(function($day) {
        return array_filter(
            array_map(function($item) {
                if($item->isOpen) {
                    return substr_replace($item->open, ':', 2, 0) . '-' . substr_replace($item->close, ':', 2, 0);
                }

                return null;
            }, $day)
        );
    })->all();
}

In this case the fields name will be business_hours. Customize this according to your database column name.

Afterwards you can use it to fill the OpeningHours class with your existing business hours like this:

// Add the use at the top of each file where you want to use the OpeningHours class:
use Spatie\OpeningHours\OpeningHours;

// Get your model instance
$model = Model::find(1);

// Fill the OpeningHours class with your business hours
$openingHours = OpeningHours::create($model->business_hours);

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Vue

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固