mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 10:07:12 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb6c1898ae |
@@ -13,5 +13,6 @@
|
||||
|
||||
### 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`
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
template: |
|
||||
## What’s Changed
|
||||
|
||||
$CHANGES
|
||||
@@ -1,41 +0,0 @@
|
||||
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 }}
|
||||
@@ -1,34 +0,0 @@
|
||||
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
|
||||
+7
-19
@@ -1,21 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
## 3.2.1 - 2024-10-28
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
### 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
|
||||
|
||||
### 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
|
||||
|
||||
## 3.2.0 - 2024-10-18
|
||||
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v3.1.0...master)
|
||||
--------------
|
||||
|
||||
### Fixed
|
||||
- Fix type of hashed model property to `string`
|
||||
@@ -26,9 +14,8 @@
|
||||
|
||||
### Added
|
||||
|
||||
- Add support for AsCollection::using and AsEnumCollection::of casts [#1577 / uno-sw](https://github.com/barryvdh/laravel-ide-helper/pull/1577)
|
||||
|
||||
## 3.1.0 - 2024-07-12
|
||||
2024-07-12, 3.1.0
|
||||
------------------
|
||||
|
||||
### Fixed
|
||||
- Fix return value of query scopes from parent class [#1366 / sforward](https://github.com/barryvdh/laravel-ide-helper/pull/1366)
|
||||
@@ -41,7 +28,8 @@
|
||||
- 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)
|
||||
|
||||
## 3.0.0 - 2024-03-01
|
||||
2024-03-01, 3.0.0
|
||||
------------------
|
||||
|
||||
### Added
|
||||
- Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520)
|
||||
|
||||
@@ -219,7 +219,7 @@ class ModelsCommand extends Command
|
||||
],
|
||||
['nowrite', 'N', InputOption::VALUE_NONE, 'Don\'t write to Model file'],
|
||||
['reset', 'R', InputOption::VALUE_NONE, 'Remove the original phpdocs instead of appending'],
|
||||
['smart-reset', 'r', InputOption::VALUE_NONE, 'Retained for compatibility, while it no longer has any effect'],
|
||||
['smart-reset', 'r', InputOption::VALUE_NONE, 'Refresh the properties/methods list, but keep the text'],
|
||||
['phpstorm-noinspections', 'p', InputOption::VALUE_NONE,
|
||||
'Add PhpFullyQualifiedNameUsageInspection and PhpUnnecessaryFullyQualifiedNameInspection PHPStorm ' .
|
||||
'noinspection tags',
|
||||
@@ -381,8 +381,6 @@ class ModelsCommand extends Command
|
||||
$realType = 'bool';
|
||||
break;
|
||||
case 'decimal':
|
||||
$realType = 'numeric';
|
||||
break;
|
||||
case 'string':
|
||||
case 'hashed':
|
||||
$realType = 'string';
|
||||
@@ -412,6 +410,8 @@ class ModelsCommand extends Command
|
||||
case 'immutable_datetime':
|
||||
$realType = '\Carbon\CarbonImmutable';
|
||||
break;
|
||||
case AsCollection::class:
|
||||
case AsEnumCollection::class:
|
||||
case 'collection':
|
||||
$realType = '\Illuminate\Support\Collection';
|
||||
break;
|
||||
@@ -437,18 +437,6 @@ class ModelsCommand extends Command
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Str::startsWith($type, AsCollection::class)) {
|
||||
$realType = $this->getTypeInModel($model, $params[0] ?? null) ?? '\Illuminate\Support\Collection';
|
||||
}
|
||||
|
||||
if (Str::startsWith($type, AsEnumCollection::class)) {
|
||||
$realType = '\Illuminate\Support\Collection';
|
||||
$relatedModel = $this->getTypeInModel($model, $params[0] ?? null);
|
||||
if ($relatedModel) {
|
||||
$realType = $this->getCollectionTypeHint($realType, $relatedModel);
|
||||
}
|
||||
}
|
||||
|
||||
$realType = $this->checkForCastableCasts($realType, $params);
|
||||
$realType = $this->checkForCustomLaravelCasts($realType);
|
||||
$realType = $this->getTypeOverride($realType);
|
||||
@@ -720,37 +708,20 @@ class ModelsCommand extends Command
|
||||
$relationReturnType === 'many' ||
|
||||
(
|
||||
!$relationReturnType &&
|
||||
str_contains(get_class($relationObj), 'Many')
|
||||
strpos(get_class($relationObj), 'Many') !== false
|
||||
)
|
||||
) {
|
||||
if ($relationObj instanceof BelongsToMany) {
|
||||
$pivot = get_class($relationObj->newPivot());
|
||||
if (!in_array($pivot, [Pivot::class, MorphPivot::class])) {
|
||||
$pivot = $this->getClassNameInDestinationFile($model, $pivot);
|
||||
|
||||
if ($existingPivot = ($this->properties[$relationObj->getPivotAccessor()] ?? null)) {
|
||||
$existingClasses = explode('|', $existingPivot['type']);
|
||||
|
||||
if (!in_array($pivot, $existingClasses)) {
|
||||
array_unshift($existingClasses, $pivot);
|
||||
}
|
||||
} else {
|
||||
// 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(),
|
||||
$unionType,
|
||||
$this->getClassNameInDestinationFile($model, $pivot),
|
||||
true,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
//Collection or array of models (because Collection is Arrayable)
|
||||
$relatedClass = '\\' . get_class($relationObj->getRelated());
|
||||
$collectionClass = $this->getCollectionClass($relatedClass);
|
||||
@@ -953,19 +924,13 @@ class ModelsCommand extends Command
|
||||
$reflection->getParentClass()->getInterfaceNames()
|
||||
);
|
||||
|
||||
$phpdoc = new DocBlock($reflection, new Context($namespace));
|
||||
if ($this->reset) {
|
||||
$phpdoc = new DocBlock('', new Context($namespace));
|
||||
$phpdoc->setText(
|
||||
(new DocBlock($reflection, new Context($namespace)))->getText()
|
||||
);
|
||||
foreach ($phpdoc->getTags() as $tag) {
|
||||
if (
|
||||
in_array($tag->getName(), ['property', 'property-read', 'property-write', 'method', 'mixin'])
|
||||
|| ($tag->getName() === 'noinspection' && in_array($tag->getContent(), ['PhpUnnecessaryFullyQualifiedNameInspection', 'PhpFullyQualifiedNameUsageInspection']))
|
||||
) {
|
||||
$phpdoc->deleteTag($tag);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$phpdoc = new DocBlock($reflection, new Context($namespace));
|
||||
}
|
||||
|
||||
$properties = [];
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Collections;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class AdvancedCastCollection extends Collection
|
||||
{
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Enums;
|
||||
|
||||
enum AdvancedCastEnum
|
||||
{
|
||||
case apple;
|
||||
case banana;
|
||||
case orange;
|
||||
}
|
||||
@@ -4,8 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Models;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Collections\AdvancedCastCollection;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Enums\AdvancedCastEnum;
|
||||
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
||||
use Illuminate\Database\Eloquent\Casts\AsCollection;
|
||||
use Illuminate\Database\Eloquent\Casts\AsEnumCollection;
|
||||
@@ -13,26 +11,21 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdvancedCast extends Model
|
||||
{
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'cast_to_date_serialization' => 'date:Y-m-d',
|
||||
'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s',
|
||||
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_date' => 'immutable_date',
|
||||
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_datetime' => 'immutable_datetime',
|
||||
'cast_to_timestamp' => 'timestamp',
|
||||
'cast_to_encrypted' => 'encrypted',
|
||||
'cast_to_encrypted_array' => 'encrypted:array',
|
||||
'cast_to_encrypted_collection' => 'encrypted:collection',
|
||||
'cast_to_encrypted_json' => 'encrypted:json',
|
||||
'cast_to_encrypted_object' => 'encrypted:object',
|
||||
'cast_to_as_collection' => AsCollection::class,
|
||||
'cast_to_as_collection_using' => AsCollection::using(AdvancedCastCollection::class),
|
||||
'cast_to_as_enum_collection' => AsEnumCollection::class,
|
||||
'cast_to_as_enum_collection_of' => AsEnumCollection::of(AdvancedCastEnum::class),
|
||||
'cast_to_as_array_object' => AsArrayObject::class,
|
||||
];
|
||||
}
|
||||
protected $casts = [
|
||||
'cast_to_date_serialization' => 'date:Y-m-d',
|
||||
'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s',
|
||||
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_date' => 'immutable_date',
|
||||
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_datetime' => 'immutable_datetime',
|
||||
'cast_to_timestamp' => 'timestamp',
|
||||
'cast_to_encrypted' => 'encrypted',
|
||||
'cast_to_encrypted_array' => 'encrypted:array',
|
||||
'cast_to_encrypted_collection' => 'encrypted:collection',
|
||||
'cast_to_encrypted_json' => 'encrypted:json',
|
||||
'cast_to_encrypted_object' => 'encrypted:object',
|
||||
'cast_to_as_collection' => AsCollection::class,
|
||||
'cast_to_as_enum_collection' => AsEnumCollection::class,
|
||||
'cast_to_as_array_object' => AsArrayObject::class,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Models;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Collections\AdvancedCastCollection;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AdvancedCasts\Enums\AdvancedCastEnum;
|
||||
use Illuminate\Database\Eloquent\Casts\AsArrayObject;
|
||||
use Illuminate\Database\Eloquent\Casts\AsCollection;
|
||||
use Illuminate\Database\Eloquent\Casts\AsEnumCollection;
|
||||
@@ -29,8 +27,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property \Illuminate\Support\Collection $cast_to_as_collection
|
||||
* @property \Illuminate\Support\Collection $cast_to_as_enum_collection
|
||||
* @property \ArrayObject $cast_to_as_array_object
|
||||
* @property AdvancedCastCollection $cast_to_as_collection_using
|
||||
* @property \Illuminate\Support\Collection<int, AdvancedCastEnum> $cast_to_as_enum_collection_of
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|AdvancedCast newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|AdvancedCast newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|AdvancedCast query()
|
||||
@@ -53,26 +49,21 @@ use Illuminate\Database\Eloquent\Model;
|
||||
*/
|
||||
class AdvancedCast extends Model
|
||||
{
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'cast_to_date_serialization' => 'date:Y-m-d',
|
||||
'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s',
|
||||
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_date' => 'immutable_date',
|
||||
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_datetime' => 'immutable_datetime',
|
||||
'cast_to_timestamp' => 'timestamp',
|
||||
'cast_to_encrypted' => 'encrypted',
|
||||
'cast_to_encrypted_array' => 'encrypted:array',
|
||||
'cast_to_encrypted_collection' => 'encrypted:collection',
|
||||
'cast_to_encrypted_json' => 'encrypted:json',
|
||||
'cast_to_encrypted_object' => 'encrypted:object',
|
||||
'cast_to_as_collection' => AsCollection::class,
|
||||
'cast_to_as_collection_using' => AsCollection::using(AdvancedCastCollection::class),
|
||||
'cast_to_as_enum_collection' => AsEnumCollection::class,
|
||||
'cast_to_as_enum_collection_of' => AsEnumCollection::of(AdvancedCastEnum::class),
|
||||
'cast_to_as_array_object' => AsArrayObject::class,
|
||||
];
|
||||
}
|
||||
protected $casts = [
|
||||
'cast_to_date_serialization' => 'date:Y-m-d',
|
||||
'cast_to_datetime_serialization' => 'datetime:Y-m-d H:i:s',
|
||||
'cast_to_custom_datetime' => 'custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_date' => 'immutable_date',
|
||||
'cast_to_immutable_custom_datetime' => 'immutable_custom_datetime:Y-m-d H:i:s',
|
||||
'cast_to_immutable_datetime' => 'immutable_datetime',
|
||||
'cast_to_timestamp' => 'timestamp',
|
||||
'cast_to_encrypted' => 'encrypted',
|
||||
'cast_to_encrypted_array' => 'encrypted:array',
|
||||
'cast_to_encrypted_collection' => 'encrypted:collection',
|
||||
'cast_to_encrypted_json' => 'encrypted:json',
|
||||
'cast_to_encrypted_object' => 'encrypted:object',
|
||||
'cast_to_as_collection' => AsCollection::class,
|
||||
'cast_to_as_enum_collection' => AsEnumCollection::class,
|
||||
'cast_to_as_array_object' => AsArrayObject::class,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ declare(strict_types=1);
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\CustomPivot;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\DifferentCustomPivot;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ModelWithPivot extends Model
|
||||
@@ -16,32 +15,4 @@ class ModelWithPivot extends Model
|
||||
->using(CustomPivot::class)
|
||||
->as('customAccessor');
|
||||
}
|
||||
|
||||
|
||||
public function relationWithDifferentCustomPivot()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(DifferentCustomPivot::class)
|
||||
->as('differentCustomAccessor');
|
||||
}
|
||||
|
||||
// without an accessor
|
||||
|
||||
public function relationCustomPivotUsingSameAccessor()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationCustomPivotUsingSameAccessorAndClass()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationWithDifferentCustomPivotUsingSameAccessor()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(DifferentCustomPivot::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
class DifferentCustomPivot extends Pivot
|
||||
{
|
||||
}
|
||||
@@ -5,25 +5,14 @@ declare(strict_types=1);
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\CustomPivot;
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\DifferentCustomPivot;
|
||||
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 CustomPivot $customAccessor
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithCustomPivot
|
||||
* @property-read int|null $relation_with_custom_pivot_count
|
||||
* @property-read DifferentCustomPivot|null $differentCustomAccessor
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithDifferentCustomPivot
|
||||
* @property-read int|null $relation_with_different_custom_pivot_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithDifferentCustomPivotUsingSameAccessor
|
||||
* @property-read int|null $relation_with_different_custom_pivot_using_same_accessor_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithPivot newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithPivot newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|ModelWithPivot query()
|
||||
@@ -37,34 +26,6 @@ class ModelWithPivot extends Model
|
||||
->using(CustomPivot::class)
|
||||
->as('customAccessor');
|
||||
}
|
||||
|
||||
|
||||
public function relationWithDifferentCustomPivot()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(DifferentCustomPivot::class)
|
||||
->as('differentCustomAccessor');
|
||||
}
|
||||
|
||||
// without an accessor
|
||||
|
||||
public function relationCustomPivotUsingSameAccessor()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationCustomPivotUsingSameAccessorAndClass()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(CustomPivot::class);
|
||||
}
|
||||
|
||||
public function relationWithDifferentCustomPivotUsingSameAccessor()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(DifferentCustomPivot::class);
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
@@ -85,22 +46,3 @@ use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
class CustomPivot extends Pivot
|
||||
{
|
||||
}
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|DifferentCustomPivot newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|DifferentCustomPivot newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|DifferentCustomPivot query()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class DifferentCustomPivot extends Pivot
|
||||
{
|
||||
}
|
||||
|
||||
@@ -9,13 +9,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Text of existing phpdoc
|
||||
*
|
||||
* @implements \ArrayAccess
|
||||
* @noinspection PhpUnreachableStatementInspection
|
||||
* @noinspection PhpUnnecessaryFullyQualifiedNameInspection
|
||||
* @property string $foo
|
||||
* @property-read string $bar
|
||||
* @method fooBar()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Simple extends Model
|
||||
{
|
||||
|
||||
@@ -9,12 +9,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Text of existing phpdoc
|
||||
*
|
||||
* @implements \ArrayAccess
|
||||
* @noinspection PhpUnreachableStatementInspection
|
||||
* @noinspection PhpUnnecessaryFullyQualifiedNameInspection
|
||||
* @property string $foo
|
||||
* @property-read string $bar
|
||||
* @method fooBar()
|
||||
* @property int $id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
|
||||
@@ -9,8 +9,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
/**
|
||||
* Text of existing phpdoc
|
||||
*
|
||||
* @implements \ArrayAccess
|
||||
* @noinspection PhpUnreachableStatementInspection
|
||||
* @property int $id
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Simple newQuery()
|
||||
|
||||
@@ -14,7 +14,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
* @property float $cast_to_real
|
||||
* @property float $cast_to_float
|
||||
* @property float $cast_to_double
|
||||
* @property numeric $cast_to_decimal
|
||||
* @property string $cast_to_decimal
|
||||
* @property string $cast_to_string
|
||||
* @property bool $cast_to_bool
|
||||
* @property bool $cast_to_boolean
|
||||
|
||||
Reference in New Issue
Block a user