mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
Add pivot class property (#1518)
* Add pivot class property * Add test for pivot class properties * Fix failed test for pivot class properties * Update CHANGELOG.md * Fix failed test
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models;
|
||||
|
||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots\CustomPivot;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @property-read CustomPivot $customAccessor
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, ModelWithPivot> $relationWithCustomPivot
|
||||
* @property-read int|null $relation_with_custom_pivot_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithPivot newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithPivot newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ModelWithPivot query()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class ModelWithPivot extends Model
|
||||
{
|
||||
public function relationWithCustomPivot()
|
||||
{
|
||||
return $this->belongsToMany(ModelwithPivot::class)
|
||||
->using(CustomPivot::class)
|
||||
->as('customAccessor');
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Pivot\Models\Pivots;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomPivot newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomPivot newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomPivot query()
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class CustomPivot extends Pivot
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user