Skip to content

Instantly share code, notes, and snippets.

@matthew-inamdar
Created August 28, 2018 09:32
Show Gist options
  • Save matthew-inamdar/bf851e0bc4d36082d3cfedb0de4030bf to your computer and use it in GitHub Desktop.
Save matthew-inamdar/bf851e0bc4d36082d3cfedb0de4030bf to your computer and use it in GitHub Desktop.
Register enum as string in Laravel migrations
<?php
if (!function_exists('register_enum_type')) {
/**
* Registers the enum type as a string.
* Call this in the constructor of your migration.
*/
function register_enum_type()
{
\Illuminate\Support\Facades\Schema::getConnection()
->getDoctrineSchemaManager()
->getDatabasePlatform()
->registerDoctrineTypeMapping('enum', 'string');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment