Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php artisan add row in table

First, create the file via Artisan (or do it manually if you like):
	php artisan make:migration name_of_the_generated_file --table=table_to_be_added_to
  
Edit the file and add on the 'function up()' so the column will be created once you do 'migrate':
	$table->define_the_type('name_of_the_column')->nullable();
	ps.: 'define_the_type' needs to be changed by the type of field you want to create.
    ps.: 'name_of_the_column' needs to be changed by the name you want the column to have.
  
Then, add on the 'function down()' so we can remove the column with the 'rollback' if needed:
	$table->dropColumn('name_of_the_column');
Comment

PREVIOUS NEXT
Code Example
Php :: create model, controller and migration in single command laravel 
Php :: php upload multiple files 
Php :: laravel blade fontawesome 
Php :: php get current page url 
Php :: laravel eloquent bulk insert 
Php :: acf get image id sub_field 
Php :: wp rest api acf fields 
Php :: symfony messenger conf 
Php :: symfony form get errors 
Php :: how to debug in wordpress 
Php :: laravel hash namespace 
Php :: php declare array 
Php :: fgets in php 
Php :: get all users created in a month laravel 
Php :: php convert array to json 
Php :: UUIDs LARAVEL 
Php :: transaction laravel 
Php :: ajax search request 
Php :: codeigniter validation text length 
Php :: laravel access request in provider 
Php :: php object into nested json object 
Php :: add key value array php 
Php :: wp+get tags for custom post type 
Php :: construct php 
Php :: php warning: php startup: unable to load dynamic library 
Php :: wordpress get post date custom format 
Php :: append in php 
Php :: get array of last 3 dates with carbon 
Php :: file is empty in php 
Php :: make resource in laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =