Skip to content

Releases: vildanbina/laravel-model-json

v2.5

Choose a tag to compare

@vildanbina vildanbina released this 16 Dec 12:08
66cf260

What's Changed

New Contributors

Full Changelog: v2.4...v2.5

v2.4

Choose a tag to compare

@vildanbina vildanbina released this 15 Sep 16:42
5a5bc24

v2.3

Choose a tag to compare

@vildanbina vildanbina released this 24 Feb 21:27
f802b5c

Changelog

  • Add --with-hidden option to include hidden fields in the export #8
  • Add arguments support to the --scope export option #9
  • Add --forget-data option to exclude data from import/export by dot notation #10

Contributors

v2.2

Choose a tag to compare

@vildanbina vildanbina released this 19 Sep 13:15
16d0be7
  • Add a scope option to the query by @RemiHin in #7

v2.1

Choose a tag to compare

@vildanbina vildanbina released this 04 Aug 07:17

replace hardcoded backslash with DIRECTORY_SEPARATOR for cross-platform compatibility

Adding a feature to import Models with relationships together

Choose a tag to compare

@vildanbina vildanbina released this 22 Apr 16:53

This package introduces a new feature that allows importing models along with their relationships from JSON. The supported relationship types include HasOne, HasMany, HasOneThrough, HasManyThrough, MorphOne, MorphMany, MorphToMany, MorphTo, BelongsTo, and BelongsToMany. You can import models with their relationships using the --with-relationships={relations} option, where {relations} represent the names of the relationships and can be separated by + if you want to attach multiple relationships.

For instance, if you want to import a Category model with its Product relationship, you can use the command:

php artisan model:import Category public/Categories.json --with-relationships=products

If you want to import a Category model along with both its Product and User relationships, you can use the command:

php artisan model:import Category public/Categories.json --with-relationships=products+user

Moreover, you can selectively import columns of the relationship using the syntax {relationship_name}:{columns_to_import}.

For example, if you want to import a Category model along with its Product relationship and only import the id and name columns of the Product, you can use the command:

php artisan model:import Category public/Categories.json --with-relationships=products:id,name

Note: that in addition to the assignment made while importing a product to a category with relationships, the Category model will also be updated with the attributes found in the JSON.

Fix issue on importing

Choose a tag to compare

@vildanbina vildanbina released this 20 Mar 12:00

fixing a bug on importing with exsiting keys by modifying the variable name

v1.0

Choose a tag to compare

@vildanbina vildanbina released this 29 Jan 22:41
update README.md