mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-26 20:34:48 +01:00
126 lines
4.0 KiB
Plaintext
126 lines
4.0 KiB
Plaintext
<?php
|
|
|
|
namespace Illuminate\Database\Eloquent\Relations;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Illuminate\Database\Eloquent\ModelNotFoundException;
|
|
|
|
/**
|
|
* @template TRelatedModel of Model
|
|
* @template-extends Relation<TRelatedModel>
|
|
* @mixin \Illuminate\Database\Eloquent\Builder<TRelatedModel>
|
|
*/
|
|
class HasManyThrough extends Relation
|
|
{
|
|
|
|
/**
|
|
* Create a new has many through relationship instance.
|
|
*
|
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
|
* @param \Illuminate\Database\Eloquent\Model $farParent
|
|
* @param \Illuminate\Database\Eloquent\Model $throughParent
|
|
* @param string $firstKey
|
|
* @param string $secondKey
|
|
* @param string $localKey
|
|
* @param string $secondLocalKey
|
|
* @return void
|
|
*/
|
|
public function __construct(Builder $query, Model $farParent, Model $throughParent, $firstKey, $secondKey, $localKey, $secondLocalKey)
|
|
{
|
|
$this->localKey = $localKey;
|
|
$this->firstKey = $firstKey;
|
|
$this->secondKey = $secondKey;
|
|
$this->farParent = $farParent;
|
|
$this->throughParent = $throughParent;
|
|
$this->secondLocalKey = $secondLocalKey;
|
|
|
|
parent::__construct($query, $throughParent);
|
|
}
|
|
|
|
/**
|
|
* Get the first related model record matching the attributes or instantiate it.
|
|
*
|
|
* @param array $attributes
|
|
* @return \Illuminate\Database\Eloquent\Model
|
|
* @psalm-return TRelatedModel
|
|
*/
|
|
public function firstOrNew(array $attributes) { }
|
|
|
|
/**
|
|
* Create or update a related record matching the attributes, and fill it with values.
|
|
*
|
|
* @param array $attributes
|
|
* @param array $values
|
|
* @return \Illuminate\Database\Eloquent\Model
|
|
* @psalm-return TRelatedModel
|
|
*/
|
|
public function updateOrCreate(array $attributes, array $values = []) { }
|
|
|
|
/**
|
|
* Execute the query and get the first related model.
|
|
*
|
|
* @param array $columns
|
|
* @return mixed
|
|
* @psalm-return TRelatedModel|null
|
|
*/
|
|
public function first($columns = ['*']) { }
|
|
|
|
/**
|
|
* Execute the query and get the first result or throw an exception.
|
|
*
|
|
* @param array $columns
|
|
* @return \Illuminate\Database\Eloquent\Model|static
|
|
* @psalm-return TRelatedModel
|
|
*
|
|
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
|
|
*/
|
|
public function firstOrFail($columns = ['*']) { }
|
|
|
|
/**
|
|
* Find a related model by its primary key.
|
|
*
|
|
* @template T
|
|
* @psalm-param T $id
|
|
* @param mixed $id
|
|
* @param array $columns
|
|
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection
|
|
* @psalm-return (T is array ? \Illuminate\Database\Eloquent\Collection<TRelatedModel>|null : TRelatedModel|null)
|
|
*/
|
|
public function find($id, $columns = ['*']) { }
|
|
|
|
/**
|
|
* Find multiple related models by their primary keys.
|
|
*
|
|
* @param mixed $ids
|
|
* @param array $columns
|
|
* @return \Illuminate\Database\Eloquent\Collection
|
|
* @psalm-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
|
|
*/
|
|
public function findMany($ids, $columns = ['*']) { }
|
|
|
|
/**
|
|
* Find a related model by its primary key or throw an exception.
|
|
* @template T
|
|
* @psalm-param T $id
|
|
* @param mixed $id
|
|
* @param array $columns
|
|
* @return \Illuminate\Database\Eloquent\Model|\Illuminate\Database\Eloquent\Collection
|
|
* @psalm-return (T is array ? \Illuminate\Database\Eloquent\Collection<TRelatedModel> : TRelatedModel)
|
|
*
|
|
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
|
|
*/
|
|
public function findOrFail($id, $columns = ['*']) { }
|
|
|
|
/**
|
|
* Execute the query as a "select" statement.
|
|
*
|
|
* @param array $columns
|
|
* @return \Illuminate\Database\Eloquent\Collection
|
|
* @psalm-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
|
|
*/
|
|
public function get($columns = ['*']) { }
|
|
}
|