mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07e3bd8796 | ||
|
|
7c2fa01d36 | ||
|
|
75b05a9f74 | ||
|
|
71aa6a6cf3 | ||
|
|
be806dc316 |
@@ -13,6 +13,5 @@
|
||||
|
||||
### Checklist
|
||||
- [ ] Existing tests have been adapted and/or new tests have been added
|
||||
- [ ] Add a CHANGELOG.md entry
|
||||
- [ ] Update the README.md
|
||||
- [ ] Code style has been fixed via `composer fix-style`
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
template: |
|
||||
## What’s Changed
|
||||
|
||||
$CHANGES
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Release Drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
# branches to consider in the event; optional, defaults to all
|
||||
branches:
|
||||
- master
|
||||
# pull_request event is required only for autolabeler
|
||||
pull_request:
|
||||
# Only following types are handled by the action, but one can default to all as well
|
||||
types: [opened, reopened, synchronize]
|
||||
# pull_request_target event is required for autolabeler to support PRs from forks
|
||||
# pull_request_target:
|
||||
# types: [opened, reopened, synchronize]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
permissions:
|
||||
# write permission is required to create a github release
|
||||
contents: write
|
||||
# write permission is required for autolabeler
|
||||
# otherwise, read permission is required at least
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# (Optional) GitHub Enterprise requires GHE_HOST variable set
|
||||
#- name: Set GHE_HOST
|
||||
# run: |
|
||||
# echo "GHE_HOST=${GITHUB_SERVER_URL##https:\/\/}" >> $GITHUB_ENV
|
||||
|
||||
# Drafts your next Release notes as Pull Requests are merged into "master"
|
||||
- uses: release-drafter/release-drafter@v6
|
||||
# (Optional) specify config name to use, relative to .github/. Default: release-drafter.yml
|
||||
# with:
|
||||
# config-name: my-config.yml
|
||||
# disable-autolabeler: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -0,0 +1,34 @@
|
||||
name: "Update Changelog"
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
permissions:
|
||||
# Give the default GITHUB_TOKEN write permission to commit and push the
|
||||
# updated CHANGELOG back to the repository.
|
||||
# https://github.blog/changelog/2023-02-02-github-actions-updating-the-default-github_token-permissions-to-read-only/
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.event.release.target_commitish }}
|
||||
|
||||
- name: Update Changelog
|
||||
uses: stefanzweifel/changelog-updater-action@v1
|
||||
with:
|
||||
latest-version: ${{ github.event.release.tag_name }}
|
||||
release-notes: ${{ github.event.release.body }}
|
||||
|
||||
- name: Commit updated CHANGELOG
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
branch: ${{ github.event.release.target_commitish }}
|
||||
commit_message: Update CHANGELOG
|
||||
file_pattern: CHANGELOG.md
|
||||
+14
-13
@@ -1,18 +1,21 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
## 3.2.1 - 2024-10-28
|
||||
|
||||
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v3.2.0...master)
|
||||
--------------
|
||||
### What's Changed
|
||||
* chore: Fix the description of unused option by @KentarouTakeda in https://github.com/barryvdh/laravel-ide-helper/pull/1600
|
||||
* feat(pivot): add support for multiple pivot types when using the same accessor by @pataar in https://github.com/barryvdh/laravel-ide-helper/pull/1597
|
||||
* Add support for `AsCollection::using` and `AsEnumCollection::of` casts by @uno-sw in https://github.com/barryvdh/laravel-ide-helper/pull/1577
|
||||
* Smarter reset by @barryvdh in https://github.com/barryvdh/laravel-ide-helper/pull/1603
|
||||
* feat: use `numeric` type on fields with `decimal` casts by @ekisu in https://github.com/barryvdh/laravel-ide-helper/pull/1583
|
||||
|
||||
### Changed
|
||||
- Add support for multiple pivot types when using the same accessor.
|
||||
- Smarter reset, keep tags that IDE helper doesn't use
|
||||
- Use `numeric` type on fields with `decimal` casts
|
||||
### New Contributors
|
||||
* @uno-sw made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1577
|
||||
* @ekisu made their first contribution in https://github.com/barryvdh/laravel-ide-helper/pull/1583
|
||||
|
||||
**Full Changelog**: https://github.com/barryvdh/laravel-ide-helper/compare/v3.2.0...v3.2.1
|
||||
|
||||
2024-10-18, 3.2.0
|
||||
--------------
|
||||
## 3.2.0 - 2024-10-18
|
||||
|
||||
### Fixed
|
||||
- Fix type of hashed model property to `string`
|
||||
@@ -25,8 +28,7 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
- Add support for AsCollection::using and AsEnumCollection::of casts [#1577 / uno-sw](https://github.com/barryvdh/laravel-ide-helper/pull/1577)
|
||||
|
||||
2024-07-12, 3.1.0
|
||||
------------------
|
||||
## 3.1.0 - 2024-07-12
|
||||
|
||||
### Fixed
|
||||
- Fix return value of query scopes from parent class [#1366 / sforward](https://github.com/barryvdh/laravel-ide-helper/pull/1366)
|
||||
@@ -39,8 +41,7 @@ All notable changes to this project will be documented in this file.
|
||||
- Add support for AsEnumCollection casts [#1557 / Braunson](https://github.com/barryvdh/laravel-ide-helper/pull/1557)
|
||||
- Support for Attribute class in attributes [#1567 / stefanScrumble](https://github.com/barryvdh/laravel-ide-helper/pull/1567)
|
||||
|
||||
2024-03-01, 3.0.0
|
||||
------------------
|
||||
## 3.0.0 - 2024-03-01
|
||||
|
||||
### Added
|
||||
- Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520)
|
||||
|
||||
@@ -720,7 +720,7 @@ class ModelsCommand extends Command
|
||||
$relationReturnType === 'many' ||
|
||||
(
|
||||
!$relationReturnType &&
|
||||
strpos(get_class($relationObj), 'Many') !== false
|
||||
str_contains(get_class($relationObj), 'Many')
|
||||
)
|
||||
) {
|
||||
if ($relationObj instanceof BelongsToMany) {
|
||||
@@ -729,16 +729,22 @@ class ModelsCommand extends Command
|
||||
$pivot = $this->getClassNameInDestinationFile($model, $pivot);
|
||||
|
||||
if ($existingPivot = ($this->properties[$relationObj->getPivotAccessor()] ?? null)) {
|
||||
// If the pivot is already set, we need to append the type to it
|
||||
$pivot .= '|' . $existingPivot['type'];
|
||||
$existingClasses = explode('|', $existingPivot['type']);
|
||||
|
||||
if (!in_array($pivot, $existingClasses)) {
|
||||
array_unshift($existingClasses, $pivot);
|
||||
}
|
||||
} else {
|
||||
// pivots are not always set
|
||||
$pivot .= '|null';
|
||||
// No existing pivot property, so we need to add a null type
|
||||
$existingClasses = [$pivot, 'null'];
|
||||
}
|
||||
|
||||
// create a union type of all pivot classes
|
||||
$unionType = implode('|', $existingClasses);
|
||||
|
||||
$this->setProperty(
|
||||
$relationObj->getPivotAccessor(),
|
||||
$pivot,
|
||||
$unionType,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
@@ -33,6 +33,12 @@ class ModelWithPivot extends Model
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationCustomPivotUsingSameAccessorAndClass()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationWithDifferentCustomPivotUsingSameAccessor()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
|
||||
@@ -14,6 +14,8 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property-read DifferentCustomPivot|CustomPivot|null $pivot
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationCustomPivotUsingSameAccessor
|
||||
* @property-read int|null $relation_custom_pivot_using_same_accessor_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationCustomPivotUsingSameAccessorAndClass
|
||||
* @property-read int|null $relation_custom_pivot_using_same_accessor_and_class_count
|
||||
* @property-read CustomPivot|null $customAccessor
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithCustomPivot
|
||||
* @property-read int|null $relation_with_custom_pivot_count
|
||||
@@ -52,6 +54,12 @@ class ModelWithPivot extends Model
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationCustomPivotUsingSameAccessorAndClass()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationWithDifferentCustomPivotUsingSameAccessor()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
|
||||
Reference in New Issue
Block a user