承接 sarahman/laravel-timestamp-boolean-fields 相关项目开发

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

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

sarahman/laravel-timestamp-boolean-fields

Composer 安装命令:

composer require sarahman/laravel-timestamp-boolean-fields

包简介

Deal with the fields whose timestamp value means their boolean status.

README 文档

README

Latest Version on Packagist Build Status Quality Score StyleCI Total Downloads

Introduction

This library can be used in the scenarios when you want to understand the db boolean field value as not only its status but also the time when it becomes true.

Code Sample

<?php

namespace App;

use Sarahman\Database\Support\BooleanTimestampFieldManipulator;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use BooleanTimestampFieldManipulator;

    protected $fillable = ['title', 'description', 'is_active'];

    protected static $boolTimestampFields = ['is_active'];

    public static function boot()
    {
        parent::boot();

        /** This trait method call is required for laravel v4.*. */
        self::bootBooleanTimestampFieldManipulator();
    }
}

Installation

This trait is installed via Composer. To install, simply add to your composer.json file:

composer require sarahman/laravel-timestamp-boolean-fields:1.1.*

After installing, you would just use it in your eloquent/model class and define the timestamp-based boolean fields in the $boolTimestampFields property as well as in $fillable property.

If the project is developed in Laravel v4.*, then you need to call bootBooleanTimestampFieldManipulator() method in the boot() of the class.

<?php
...
    public static function boot()
    {
        parent::boot();

        self::bootBooleanTimestampFieldManipulator();
    }
...

Note: The timestamp-based field names must be prefixed by is_; and the field names without its is_ prefix will be appended in the model attributes with time_being_ prefix; i.e. is_active field name will appended in the model attributes as time_being_active name. The is_active field value will be boolean and time_being_active field value will the timestamp value.

Support

If you are having general issues with this package, feel free to contact me through Gmail.

If you believe you have found an issue, please report it using the GitHub issue tracker, or better yet, fork the repository and submit a pull request.

Contribution

If you're using this package, I'd love to hear your thoughts. Thanks! Please feel free to contribute in this library and send us pull requests.

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固