Answers for "laravel new table"

PHP
1

create table laravel

php artisan make:migration create_table_name --create=tablel_name
php artisan migrate
Posted by: Guest on August-16-2021
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
0

create table laravel

php artisan make:migration create_employeeDetails_table --create=Employee
//goto create_employeeDetails_table file and add fields in table
php artisan migrate
Posted by: Guest on April-12-2021

Code answers related to "laravel new table"

Browse Popular Code Answers by Language