定制 sukohi/custom-cast 二次开发

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

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

sukohi/custom-cast

Composer 安装命令:

composer require sukohi/custom-cast

包简介

A Laravel package for custom casts.

README 文档

README

A Laravel package for custom casts.

Installation

Execute composer command.

composer require sukohi/custom-cast:1.*

Preparation

Simple Way

In your model, set CustomCastTrait and add $casts as usual.

<?php

namespace App;
use Sukohi\CustomCast\CustomCastTrait;

class User {

    use CustomCastTrait;
    
    protected $casts = [
        'column' => 'CUSTOM-CAST-NAME'
    ];

Now you can use custom casts.

Alphabet boolean

  • true <=> 'T'
  • false <=> 'F'

You need to set alpha_boolean.
This might be useful for JavaScript Object key.

protected $casts = [
    'activated' => 'alpha_boolean'
];

Alphabet ternary

  • 1 <=> 'T'
  • 2 <=> 'F'
  • 0 <=> 'U' (unknown)

You need to set alpha_ternary.

protected $casts = [
    'status_type_id' => 'alpha_ternary'
];

Short time

  • hh::ii:ss => hh:ii

    protected $casts = [ 'meeting_time' => 'short_time' ];

    // i.g) 01:02:03 => 01:02

License

This package is licensed under the MIT License.

Copyright 2017 Sukohi Kuhoh

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-07-31

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固