Skip to content

Commit

Permalink
#55 add ability to specify multiple columns to translate on a single …
Browse files Browse the repository at this point in the history
…model (#56)

* #55 add ability to specify multiple columns to translate on a single model

* #55 add dependencies updates
  • Loading branch information
khalyomede authored Nov 3, 2023
1 parent 4b35191 commit 2843023
Show file tree
Hide file tree
Showing 8 changed files with 320 additions and 240 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Ability to specify multiple columns to translate for a single model ([#55](https://github.com/khalyomede/laravel-translate/issues/55)).

### Breaking

- The order of the translations is not the same when translating a single model column ([#55](https://github.com/khalyomede/laravel-translate/issues/55)).

## [0.1.2] - 2023-09-19

### Fixed
Expand Down
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,23 @@ return [
];
```

If you have multiple columns for the same model, you can also pass an array:

```php
use App\Models\Post;

return [
// ...
"models" => [
Post::class => [
"title",
"description",
],
],
// ...
];
```

You pass it the name of the model as key, and the name of the column to pull translation from as the value.

This assumes you translate your model like this for example:
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"stillat/blade-parser": "1.*"
},
"require-dev": {
"orchestra/testbench": "8.12.1",
"nunomaduro/collision": "7.9.0",
"rector/rector": "0.18.4",
"driftingly/rector-laravel": "0.26.1",
"phpstan/phpstan": "1.10.37",
"orchestra/testbench": "8.14.0",
"nunomaduro/collision": "7.10.0",
"rector/rector": "0.18.6",
"driftingly/rector-laravel": "0.26.2",
"phpstan/phpstan": "1.10.40",
"nunomaduro/larastan": "2.6.4",
"friendsofphp/php-cs-fixer": "3.34.0"
"friendsofphp/php-cs-fixer": "3.37.1"
},
"scripts": {
"test": "testbench package:test",
Expand All @@ -61,4 +61,4 @@
]
}
}
}
}
Loading

0 comments on commit 2843023

Please sign in to comment.