Skip to content

Allows Laravel migrations to create FLOAT columns in MySQL

Notifications You must be signed in to change notification settings

likemusic/laravel-mysql-float

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel MySQL Float

This package allows database migrations in Laravel 5 and Laravel 6 to create FLOAT columns in MySQL.

Inspired by fisharebest/laravel-floats.

Implemented with more lower level.

At the moment I test it only with Laravel 5.4.

To use at Laravel 5.4 (without auto-discovery packages providers) add in config/app.php to providers array provider \Likemusic\LaravelMysqlFloat\MySqlConnectionProvider::class.

How does this package work?

It overrides Illuminate\Database\Schema\Grammars\MySqlGrammar::typeFloat(Fluent $column) to

    protected function typeFloat(Fluent $column)
    {
        if ($column->total && $column->places) {
            return "float({$column->total}, {$column->places})";
        }

        return 'float';
    }

instead of default $this->typeDouble().

Also it change signature for Illuminate\Database\Schema\Blueprint::float($column, $total = 8, $places = 2) to float($column, $total = null, $places = null).

And also contains some classes for using this overrides by using custom resolvers.

TODO

  • Add tests

About

Allows Laravel migrations to create FLOAT columns in MySQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages