Skip to content

Commit

Permalink
Update modeltyper.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ayrtonandino committed Nov 29, 2024
1 parent 17e92fd commit 7be1e82
Showing 1 changed file with 92 additions and 38 deletions.
130 changes: 92 additions & 38 deletions config/modeltyper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
| ],
Expand Down

0 comments on commit 7be1e82

Please sign in to comment.