Answers for "add field to db laravel"

PHP
6

laravel migration remove column

public function up()
{
  Schema::table('table', function($table) {
    $table->dropColumn('column_name');
  });
}
Posted by: Guest on April-16-2020
1

add column to migration laravel

class AddProfileToUsers extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function (Blueprint $table) {
            $table->string('profile')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('shop_users', function (Blueprint $table) {
            $table->dropColumn(['profile']);
        });
    }
}
Posted by: Guest on June-08-2020

Code answers related to "add field to db laravel"

Browse Popular Code Answers by Language