2017 © Pedro Peláez
 

library custom-cast

A Laravel package for custom casts.

image

sukohi/custom-cast

A Laravel package for custom casts.

  • Wednesday, August 16, 2017
  • by Sukohi
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

CustomCast

A Laravel package for custom casts., (*1)

Installation

Execute composer command., (*2)

composer require sukohi/custom-cast:1.*

Preparation

Simple Way, (*3)

In your model, set CustomCastTrait and add $casts as usual., (*4)

<?php

namespace App;
use Sukohi\CustomCast\CustomCastTrait;

class User {

    use CustomCastTrait;

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

Now you can use custom casts., (*5)

Alphabet boolean

  • true = 'T'
  • false = 'F'

You need to set alpha_boolean.
This might be useful for JavaScript Object key., (*6)

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

Alphabet ternary

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

You need to set alpha_ternary., (*7)

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

Short time

  • hh::ii:ss => hh:ii, (*8)

    protected $casts = [ 'meeting_time' => 'short_time' ];, (*9)

    // i.g) 01:02:03 => 01:02, (*10)

License

This package is licensed under the MIT License., (*11)

Copyright 2017 Sukohi Kuhoh, (*12)

The Versions

16/08 2017

1.0.x-dev

1.0.9999999.9999999-dev

A Laravel package for custom casts.

  Sources   Download

The Requires

 

by Avatar Sukohi

16/08 2017

dev-master

9999999-dev

A Laravel package for custom casts.

  Sources   Download

The Requires

 

by Avatar Sukohi

16/08 2017

1.0.2

1.0.2.0

A Laravel package for custom casts.

  Sources   Download

The Requires

 

by Avatar Sukohi

02/08 2017

1.0.1

1.0.1.0

A Laravel package for custom casts.

  Sources   Download

The Requires

 

by Avatar Sukohi

31/07 2017

1.0.0

1.0.0.0

A Laravel package for custom casts.

  Sources   Download

The Requires

 

by Avatar Sukohi