Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel migration set default value

$table->string('name')->default('Hello World!');
Comment

laravel migration change default value

Schema::table('users', function ($table) {
    $table->integer('active')->default(0)->change();
});
Comment

set default value for column in laravel model

protected $attributes = [ 
	'your_field_name' => 'default value' 
]; 
Comment

laravel migration change column default

Schema::table('users', function ($table) {
    $table->integer('active')->default(0)->change();
});
Comment

how assign default value to laravel migration column

You can use change() method:

Schema::table('users', function ($table) {
    $table->integer('active')->default(0)->change();
});
Comment

PREVIOUS NEXT
Code Example
Php :: laravel insert timestamp now 
Php :: php list all constants 
Php :: only display part of string php 
Php :: change datetime format from Y-m-d h:i:s to d-m-Y in php 
Php :: dummy data in laravel 
Php :: php check connection to database 
Php :: php strftime 
Php :: acf repeater 
Php :: update query in codeigniter using where condition 
Php :: create char laravel migration 
Php :: php sort array by value length 
Php :: larvel make http request 
Php :: php info 
Php :: run shell script from php file 
Php :: create a wp plugin 
Php :: how to run specific migration in laravel 
Php :: laravel collection transform 
Php :: str_contains 
Php :: php switch statement 
Php :: php if $_post 
Php :: PHP Function to create GUID 
Php :: enable gd php 
Php :: how to check php version codeigniter 3 
Php :: laravel eloquent get first 
Php :: how to install php dependencies 
Php :: laravel where json contains 
Php :: Carbon Add Hours In Laravel 
Php :: PDOException::("could not find driver") windows 
Php :: laravel range query 
Php :: php implode array 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =