Answers for "laravel 8 migration from existing database"

PHP
21

laravel foreign key

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

    $table->foreign('user_id')->references('id')->on('users');
});
OR
Schema::table('posts', function (Blueprint $table) {
    $table->foreignId('user_id')->constrained();
});
Posted by: Guest on December-09-2020
1

create database from migration laravel for all

php artisan migrate:refresh

php artisan migrate:refresh --seed
Posted by: Guest on August-05-2020
0

create database from migration laravel for all

php artisan migrate --force
Posted by: Guest on August-05-2020
0

Generate Laravel Migrations from an existing database

composer require --dev "xethron/migrations-generator"
Posted by: Guest on March-14-2021

Code answers related to "laravel 8 migration from existing database"

Browse Popular Code Answers by Language