Due to Laravel migration system, we can create database tables by running the following command lines.
php artisan migrate:make create_users_table
class CreateUserTable extends Migration {
public function up() {
Schema::create('users', function($table)
{
$table->increments('id');
$table->string('email')->unique();
$table->string('name');
$table->timestamps();
});
}
public function down() {
Schema::drop('users');
}
}
php artisan migrate
If I work with relational database and have two tables, A and B. Table A is related to table B by a foreign key. Is it possible to create such database tables with Laravel Migration System? Or do I need to configure the relationship in phpmyadmin manually?
DB::statement()in the migrations for complex SQL.