Generate model, migration, factory, and seed
php artisan make:model ModelName -mfs
Add columns in the migration
Schema::create('model_name', static function (Blueprint $table) {
$table->id();
$table->foreignId('model_name_id')->constrained();
$table->string('value');
$table->timestamps();
});
Add fillable values and relationships in the model
protected $fillable = [
'model_name_id',
'value',
];
public function attribute(): BelongsTo
{
return $this->belongsTo(ModelName::class);
}