Answers for "migration in laravel 7"

PHP
5

laravel migration

php artisan make:migration create_users_table --create=users

php artisan make:migration add_votes_to_users_table --table=users
Posted by: Guest on July-18-2020
0

laravel migration constrained

Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained();
});

/* The foreignId method is an alias for unsignedBigInteger while the
 * constrained method will use conventions to determine the table and
 * column name being referenced. If your table name does not match
 * Laravel's conventions, you may specify the table name by passing it
 * as an argument to the constrained method:
*/

Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained('users');
});
Posted by: Guest on December-29-2020
0

laravel what is migrations

php artisan make: migración create_articles_table --create = artículos
Posted by: Guest on September-25-2021

Code answers related to "migration in laravel 7"

Browse Popular Code Answers by Language