From 7be1e8285716d5f6b546876870d954b8b218d666 Mon Sep 17 00:00:00 2001 From: Ayrton Andino Bonazzola <60512432+ayrtonandino@users.noreply.github.com> Date: Fri, 29 Nov 2024 18:59:57 -0300 Subject: [PATCH] Update modeltyper.php --- config/modeltyper.php | 130 ++++++++++++++++++++++++++++++------------ 1 file changed, 92 insertions(+), 38 deletions(-) diff --git a/config/modeltyper.php b/config/modeltyper.php index 7b7ebe4..709c5f9 100644 --- a/config/modeltyper.php +++ b/config/modeltyper.php @@ -3,132 +3,187 @@ return [ /* |-------------------------------------------------------------------------- - | Generate typescript interfaces in a global namespace named models + | Generate TypeScript Interfaces in a Global Namespace |-------------------------------------------------------------------------- | - | Custom mappings allow you to add support for types that are considered - | unknown or override existing mappings. - | - | You can also add mappings for your Custom Casts. + | Specifies whether to generate TypeScript interfaces within a global + | namespace. This helps in organizing the interfaces and + | avoiding naming conflicts. | - | For example: - | 'App\Casts\YourCustomCast' => 'string|null', - | 'binary' => 'Blob', - | 'bool' => 'boolean', - | 'point' => 'CustomPointInterface', - | 'year' => 'string', + | Uses config 'global-namespace' as Namespace */ 'global' => false, /* |-------------------------------------------------------------------------- - | Should echo the definitions into a file + | Global Namespace Name for TypeScript Interfaces |-------------------------------------------------------------------------- + | + | Defines the name of the global namespace where the TypeScript interfaces + | will be generated. This helps in maintaining a clear structure for the + | TypeScript codebase. + */ + 'global-namespace' => 'models', + + /* + |-------------------------------------------------------------------------- + | Output TypeScript Definitions to a File + |-------------------------------------------------------------------------- + | + | Specifies whether to output the TypeScript definitions to a file. If set + | to true, the definitions will be saved to the specified file path. */ 'output-file' => false, /* |-------------------------------------------------------------------------- - | Output the result as json + | Path for Output TypeScript Definitions File |-------------------------------------------------------------------------- + | + | Defines the file path where the TypeScript definitions will be saved. This + | path is used only if 'output-file' is set to true. */ 'output-file-path' => './resources/js/types/models.d.ts', /* |-------------------------------------------------------------------------- - | Output the result as json + | Output the Result in JSON Format |-------------------------------------------------------------------------- + | + | Specifies whether to output the TypeScript definitions in JSON format. This + | can be useful for further processing or integration with other tools. */ 'json' => false, /* |-------------------------------------------------------------------------- - | Use typescript enums instead of object literals + | Use TypeScript Enums Instead of Object Literals |-------------------------------------------------------------------------- + | + | Determines whether to use TypeScript enums instead of object literals for + | representing certain data structures. Enums provide a more type-safe and + | expressive way to define sets of related constants. */ 'use-enums' => false, /* |-------------------------------------------------------------------------- - | Output model plurals + | Output Plural Form for Models |-------------------------------------------------------------------------- + | + | Specifies whether to output the plural form of model names. This can be + | useful for consistency and clarity when dealing with collections of models. + | + | Uses Laravel Pluralizer */ 'plurals' => false, /* |-------------------------------------------------------------------------- - | Do not include relations + | Exclude Model Relationships |-------------------------------------------------------------------------- + | + | Determines whether to exclude model relationships from the TypeScript + | definitions. This can be useful if relationships are not needed in the + | TypeScript codebase. */ 'no-relations' => false, /* |-------------------------------------------------------------------------- - | Make relations optional fields on the model type + | Make Model Relationships Optional |-------------------------------------------------------------------------- + | + | Specifies whether to make model relationships optional in the TypeScript + | definitions. This allows for more flexibility in handling models that may + | or may not have related data. */ 'optional-relations' => false, /* |-------------------------------------------------------------------------- - | Do not include hidden model attributes + | Exclude Hidden Model Attributes |-------------------------------------------------------------------------- + | + | Determines whether to exclude hidden model attributes from the TypeScript + | definitions. Hidden attributes are typically not needed in the client-side + | code. */ 'no-hidden' => false, /* |-------------------------------------------------------------------------- - | Output timestamps as a Date object type + | Output Timestamps as Date Object Types |-------------------------------------------------------------------------- + | + | Specifies whether to output timestamps as Date object types. This allows + | for more accurate and type-safe handling of date and time values in the + | TypeScript code. */ 'timestamps-date' => false, /* |-------------------------------------------------------------------------- - | Output nullable attributes as optional fields + | Make Nullable Attributes Optional |-------------------------------------------------------------------------- + | + | Determines whether to make nullable attributes optional in the TypeScript + | definitions. This provides better handling of attributes that may not have + | a value. */ 'optional-nullables' => false, /* |-------------------------------------------------------------------------- - | Output api.MetApi interfaces + | Output api.MetApi Interfaces |-------------------------------------------------------------------------- + | + | Specifies whether to output TypeScript interfaces for api.MetApi resources. */ 'api-resources' => false, /* |-------------------------------------------------------------------------- - | Attempt to resolve abstract models + | Resolve Abstract Model Classes |-------------------------------------------------------------------------- + | + | Determines whether to attempt to resolve abstract model classes. This can + | be useful for generating TypeScript definitions for models that extend + | abstract base classes. */ 'resolve-abstract' => false, /* |-------------------------------------------------------------------------- - | Output model fillables + | Output Fillable Model Attributes |-------------------------------------------------------------------------- + | + | Specifies whether to output fillable model attributes in the TypeScript + | definitions. Fillable attributes are those that can be mass-assigned. */ 'fillables' => false, /* |-------------------------------------------------------------------------- - | fillable-suffix + | Suffix for Fillable Model Attributes |-------------------------------------------------------------------------- + | + | Defines a suffix to be added to fillable model attributes in the TypeScript + | definitions. This can help in distinguishing fillable attributes from + | other attributes. */ 'fillable-suffix' => '', /* |-------------------------------------------------------------------------- - | Override default mappings or add new ones + | Override or Add New Type Mappings |-------------------------------------------------------------------------- | | Custom mappings allow you to add support for types that are considered - | unknown or override existing mappings. - | - | You can also add mappings for your Custom Casts. + | unknown or override existing mappings. You can also add mappings for your + | custom casts. | - | For example: + | Example: | 'App\Casts\YourCustomCast' => 'string|null', | 'binary' => 'Blob', | 'bool' => 'boolean', @@ -141,18 +196,17 @@ /* |-------------------------------------------------------------------------- - | Custom relationships + | Define Custom Relationships |-------------------------------------------------------------------------- | - | Custom relationships allows you to add support for relationships from - | external packages that are not a part of the Laravel core. - | - | Note that relationship method names are case sensitive. + | Custom relationships allow you to add support for relationships from + | external packages that are not a part of the Laravel core. Note that + | relationship method names are case sensitive. | - | singular: relationships that return a single model - | plural: relationships that return multiple models + | Singular: relationships that return a single model + | Plural: relationships that return multiple models | - | For example: + | Example: | 'singular' => [ | 'belongsToThrough', | ],