How to create one-to-many relation in database using Laravel

Framework
Laravel

How to create one-to-many relation in database using Laravel

Applying one-to-many relationship in the database using Laravel Steps 1. Create a migration file for adding a new table students php artisan make:migration create_table_students 2. Add the following code in the up function Schema::create(‘students’, function(Blueprint $table) { $table->integer(‘id’)->primary(); $table->string(‘name’); $table->text(’email’); $table->string(‘course’); $table->boolean(‘done’)->default(false); $table->timestamps(); }); 3. Create a migration file for adding a new table subjects […]

Read More