You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Laravel supports stub customization for many Artisan commands (make:model, make:controller, etc.), but does not currently support it for:
php artisan make:factory
php artisan make:seeder
This makes it difficult to enforce standardized boilerplate (like traits or structure) across teams or company projects. Developers are forced to either:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Laravel supports stub customization for many Artisan commands (
make:model
,make:controller
, etc.), but does not currently support it for:php artisan make:factory
php artisan make:seeder
This makes it difficult to enforce standardized boilerplate (like traits or structure) across teams or company projects. Developers are forced to either:
Proposed Solution
Add support for a
--stub
option in:make:factory
make:seeder
Example usage:
bash
Behavior:
Code Change Overview
1. Update Command Signatures
php
// FactoryMakeCommand.php
protected $signature = 'make:factory {name} {--model=} {--stub=}';
// SeederMakeCommand.php
protected $signature = 'make:seeder {name} {--stub=}';
2. Update buildClass() Method
php
Similar logic can be added to SeederMakeCommand.
Benefits:
Use case and benefit
Company-wide conventions: Apply traits, comments, or rules uniformly
Advanced seeding: Pre-fill relationship logic
Team collaboration: Avoid manual edits or workarounds
Package development: Publish opinionated stubs
Willingness to Contribute
✅ I’m happy to create a PR if this feature is approved by the Laravel core team.
Beta Was this translation helpful? Give feedback.
All reactions