Answers for "enum in laravel migration"

PHP
3

laravel enum migration example

$table->enum('animal_type',['cat','dog','unknown'])->default('unknown');
Posted by: Guest on October-02-2021
21

laravel foreign key

Schema::table('posts', function (Blueprint $table) {
    $table->unsignedBigInteger('user_id');

    $table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained();
});
Posted by: Guest on December-09-2020
3

laravel enum migration

Add Laravel enmu migration : 
------------------------------
$table->enum('question_type', ['objective', 'subjective', 'multiple_choice']);

Update Laravel enum migration :
---------------------------------
DB::statement("ALTER TABLE users CHANGE COLUMN permissions permissions ENUM('admin', 'user', 'candidate') NOT NULL DEFAULT 'user'");
Posted by: Guest on July-23-2020
0

enum table in laravel

$table->enum('priority', ['normal', 'medium', 'high'])->default('normal');
Posted by: Guest on October-12-2021
1

Laravel Migration - Update Enum Options

DB::statement("ALTER TABLE users CHANGE COLUMN permissions permissions ENUM('admin', 'user', 'candidate') NOT NULL DEFAULT 'user'");
Posted by: Guest on April-28-2021

Browse Popular Code Answers by Language