PHP code example of liquid207 / laravel-enum-migration
1. Go to this page and download the library: Download liquid207/laravel-enum-migration library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
liquid207 / laravel-enum-migration example snippets
class User extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
// Append one
$table->enumAppend('type', 'option1');
// Append array
$table->enumAppend('type', ['option2', 'option3']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
// Remove one
$table->enumRemove('type', 'option1');
// Remove array
$table->enumRemove('type', ['option2', 'option3']);
});
}
}