Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Pivot Table Generator

Laravel Pivot Table Generator Laravel Package

timwassenburg/laravel-pivot-table-generator

Generate pivot table migrations for Laravel many-to-many relationships with this package. It scaffolds the intermediate tables Eloquent needs, helping you set up and maintain consistent database schemas with less boilerplate.

View on GitHub
Deep Wiki
Context7

timwassenburg/laravel-pivot-table-generator is a small Laravel package that scaffolds pivot table migrations for many-to-many relationships. Instead of hand-writing the intermediate table schema, you run an Artisan command and get a ready-to-edit migration with the correct naming convention and foreign key columns.

It keeps your models and database in sync with minimal boilerplate, making it handy when adding relationships to existing projects.

  • Generates pivot migration files via Artisan
  • Follows Laravel's conventional table naming
  • Creates properly typed foreign key columns
  • Editable output you can extend with extra columns
  • Compatible with standard Laravel migrations
Frequently asked questions about Laravel Pivot Table Generator
What does timwassenburg/laravel-pivot-table-generator actually do?
It is a Laravel package that provides Artisan commands to generate pivot table migrations and models for many-to-many relationships. Instead of hand-writing the intermediate table schema and its Eloquent model, you run a command and get a starting point with customizable columns and naming conventions. It is a scaffolding and developer-tooling package rather than a runtime feature, so it does not change how Eloquent relationships behave once your code is generated and committed.
How do I install laravel-pivot-table-generator in a Laravel app?
Install it with Composer using composer require timwassenburg/laravel-pivot-table-generator. Check the package's composer.json for PHP and Laravel version constraints before adding it to an existing project, because the v1.0.1 release notes do not restate supported versions. Once installed, the Artisan commands become available; consult the README for the exact command signatures and options. Generate into a sandbox branch first so you can inspect the produced migration and model before committing them.
Which Laravel and PHP versions does this package support?
The package's composer.json is the authoritative source for PHP and Laravel constraints, so check that file and confirm whether CI runs the test suite against the Laravel major versions you use. The v1.0.1 release notes do not document supported version ranges or dependency changes. Treat compatibility as unverified until you have installed it in a project pinned to your production Laravel version. If your application runs an older Laravel major, test there rather than assuming it works.
Does it generate the pivot model as well as the migration?
Yes. The package is described as generating both pivot table migrations and models for many-to-many relationships, so you get an intermediate model you can extend with relationships or pivot attributes rather than a bare migration. You should still review the generated files and adjust table names, keys, and timestamp handling to match your project conventions. Treat the output as a starting point that needs a code review, not a finished schema.
How does it handle custom pivot columns and naming conventions?
The package advertises customizable columns and naming conventions, so you can tailor the intermediate table to carry extra pivot data instead of only the two foreign keys. The exact options depend on the command arguments and flags documented in the README. Verify the generated output matches your project's naming standard, especially if you use table prefixes or UUID or ULID primary keys. Check any hand-added columns against your existing migrations to avoid duplicates.
Is it safe to use in production?
The generated artifacts are ordinary migrations and Eloquent models, so production risk comes from the schema you accept rather than from runtime code injected into your application. Review every generated migration before running it, since foreign keys, uniqueness constraints, column ordering, and cascade behaviour are decisions you should own. The package is at v1.0.1 with limited coverage described as a single simple test, so treat it as early-stage software. Because it is a development-time convenience, you can remove the dependency later without affecting the committed migrations and models.
How is this package tested, and can I rely on its test suite?
The repository uses PEST with GitHub Actions CI, plus PhpStan and Pint for static analysis and code style, but the v1.0.1 notes describe only a single simple test. That is enough to prove the pipeline runs, not enough to guarantee edge-case coverage of the generators. Run the suite locally with the project's Composer scripts or vendor/bin/pest, and add your own assertions around the generated file contents. Do not treat green CI as evidence that the package integrates cleanly with your application.
What changed in v1.0.1, and are there new features?
No new features or API changes are reported. The v1.0.1 release is a tooling and code-style milestone covering PhpStan, Pint, GitHub Actions, PEST, and a simple test. Pint-driven style changes are usually cosmetic, but if you are upgrading from v1.0.0 it is still worth diffing the generated output before and after. If you were already on v1.0.0, upgrading should be a Composer version bump with no code changes required.
What are the alternatives to using a pivot table generator package?
You can write the intermediate table by hand with a Schema::create migration and add a belongsToMany relationship plus a custom Pivot model, which for a single join table is often faster than adopting a dependency. Laravel's own make:migration and make:model commands, or a generic scaffolding package, cover much of the same ground. The case for this package is repetition: many join tables that share a naming convention and carry extra pivot columns. Choose it when the convention it encodes matches your project's conventions.
Who maintains this package, and what is its release cadence and backwards compatibility policy?
It is maintained by Tim Wassenburg as timwassenburg/laravel-pivot-table-generator and is currently at v1.0.1. The release notes do not state an explicit backward-compatibility policy or release cadence, and the CI and static analysis tooling appears to have been added recently, which points to an early-stage project. For a development-time generator the blast radius of a breaking change is limited to the commands you run, so the practical risk is low. Even so, pin the version in composer.json and read changelogs before upgrading.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core