Month Model

For understanding, how the model code works, please refer to country model or company model

Below code create month model and migration

php artisan make:model Month -m
Model class

Replace model class with below code.

Note: Please use the copy button to copy the source code.

class Month extends Model { use HasFactory; protected $fillable = [ 'month', 'monthName', ]; }
Migration class

Replace the up() and down() methods with the code below.

public function up() { Schema::create('months', function (Blueprint $table) { $table->id(); $table->integer('month'); $table->string('monthName'); $table->timestamps(); }); } public function down() { Schema::dropIfExists('months'); }

To create/update the table to database, we need to run artisan migrate command

php artisan migrate