Today in this tutorial, I will tell you how to migrate to laravel.With the help of an artisan command in laravel, we can easily create a table and a column in phpmyadmin with the help of migration.
php artisan make:migration create_users_table --create=users
After running these commands, you can see the file inside the database/migration folder.
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class CreateUsersTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table->increments('id'); $table->string('name'); $table->string('email')->unique(); $table->string('password'); $table->rememberToken(); $table->timestamps(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('users'); } }
In laravel, schema is a way that tells it. That we have to create a table of this name.