mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-26 20:34:48 +01:00
37 lines
945 B
Plaintext
37 lines
945 B
Plaintext
<?php
|
|
|
|
namespace Illuminate\Database\Eloquent\Relations;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Relations\Concerns\SupportsDefaultModels;
|
|
|
|
/**
|
|
* @template TRelatedModel of Model
|
|
* @template-extends HasManyThrough<TRelatedModel>
|
|
* @mixin \Illuminate\Database\Eloquent\Builder<TRelatedModel>
|
|
*/
|
|
class HasOneThrough extends HasManyThrough
|
|
{
|
|
use SupportsDefaultModels;
|
|
|
|
/**
|
|
* Get the results of the relationship.
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function getResults()
|
|
{
|
|
return $this->first() ?: $this->getDefaultFor($this->farParent);
|
|
}
|
|
|
|
/**
|
|
* Make a new related instance for the given model.
|
|
*
|
|
* @param \Illuminate\Database\Eloquent\Model $parent
|
|
* @return \Illuminate\Database\Eloquent\Model
|
|
* @psalm-return TRelatedModel
|
|
*/
|
|
public function newRelatedInstanceFor(Model $parent) { }
|
|
}
|