Repository navigation
Version 2.2.14
Full Changelog: 2.2.13...2.2.14
Added
-
SkipApiGeneration Attribute: New functionality to gain granular control over which relationships are included in API generation.
-
Using the
#[SkipApiGeneration]attribute, you can ignore specific relationships. -
Supports scopes to selectively ignore relationships for actions, requests, or resource (or all at once).
-
Example:
#[SkipApiGeneration([SkipApiGeneration::ACTIONS])]above a relationship method ensures it is not updateable but still visible in the Resource. -
Smart Relation Detection: The generator now supports all standard Eloquent relations and automatically distinguishes between "Single" relations (returning an object, such as
HasOne,BelongsTo,HasOneThrough) and "Collection" relations (returning an array/collection, such asHasMany,BelongsToMany). -
Newly supported relations:
MorphOne,MorphTo,HasOneThrough,MorphMany,HasManyThrough,MorphedByMany.
Advanced CLI Options:
-
--force: Overwrite existing files without confirmation. -
--only: Generate only specific parts (controller, actions, requests, or resource). -
--except: Exclude specific parts from generation. -
Improved Resource Generation: Resources are now correctly wrapped:
new UserResource(...)for single relations andUserResource::collection(...)for collections. -
Strict Typing:
MakeApiResourcenow usesstrict types (declare(strict_types=1);). -
Route Suggestion: After successful generation, the correct
Route::apiResourceline is displayed directly in the console.
Improved
MorphedByManyFix:MorphedByManyrelations are now correctly recognized as pivot relations and no longer mistakenly treated asHasMany(due to stricter in_array checks instead ofstartsWith).- Validation Logic: Validation rules for requests have been tightened. For "Single" relations, validation is now correctly applied to
relation.fieldinstead ofrelation.*.field. - UX Improvements:
- The interaction when overwriting directories (such as
ActionsandRequests) has been improved: you are now asked once whether to overwrite the entire directory instead of per file. - Clearer console output with step-by-step status messages.
Bugfixes:
- Fixed: Double prompts when overwriting directories.
- Fixed: Error when selecting from multiple Resources (returned path instead of namespace).
- Fixed: Crash when
getClassNamefailed on unknown relations.