0
Q:

laravel add column to table

php artisan make:migration add_paid_to_users_table --table=users
0
Schema::table('users', function (Blueprint $table) {
	$table->dateTime('verify_date')->nullable()->after("password_updated_at");
});
2
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']);
        });
    }
}
1
Schema::rename($currentTableName, $newTableName);
3
Schema::table('table_name', function (Blueprint $table) {
            $table->string('column_name', 255)->nullable()->after('previous_column_name');
        });
2
php artisan migrate
0
php artisan make:migration create_users_table
2
public function up()
{
    Schema::table('users', function($table) {
        $table->integer('paid');
    });
}
0

New to Communities?

Join the community