mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 01:57:13 +00:00
* Implement new config to specify return type of custom relations * Apply suggestions from code review Co-authored-by: Markus Podar <[email protected]> * add test for morphed * fix test output * add info about how to add custom relationships * fix wording Co-authored-by: Markus Podar <[email protected]>
38 lines
1.3 KiB
PHP
38 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Traits;
|
|
|
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyRelationType;
|
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToAnyMorphedRelationType;
|
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToManyRelationType;
|
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToOneRelationType;
|
|
|
|
trait HasTestRelations
|
|
{
|
|
public function testToOneRelation($related)
|
|
{
|
|
$instance = $this->newRelatedInstance($related);
|
|
return new SampleToOneRelationType($instance->newQuery(), $this);
|
|
}
|
|
|
|
public function testToManyRelation($related)
|
|
{
|
|
$instance = $this->newRelatedInstance($related);
|
|
return new SampleToManyRelationType($instance->newQuery(), $this);
|
|
}
|
|
|
|
public function testToAnyRelation($related)
|
|
{
|
|
$instance = $this->newRelatedInstance($related);
|
|
return new SampleToAnyRelationType($instance->newQuery(), $this);
|
|
}
|
|
|
|
public function testToAnyMorphedRelation($related)
|
|
{
|
|
$instance = $this->newRelatedInstance($related);
|
|
return new SampleToAnyMorphedRelationType($instance->newQuery(), $this);
|
|
}
|
|
}
|