1
0
mirror of https://github.com/flarum/core.git synced 2025-08-11 19:04:29 +02:00

feat: STUBS!

This commit is contained in:
Matthew Kilgore
2021-12-01 17:36:36 -05:00
parent c561897f1c
commit 05aa62f70c
35 changed files with 19100 additions and 3 deletions

View File

@@ -0,0 +1,112 @@
<?php
namespace Illuminate\Database\Eloquent\Relations;
/**
* @template TRelatedModel of \Illuminate\Database\Eloquent\Model
* @extends Relation<TRelatedModel>
*/
class BelongsToMany extends Relation
{
/**
* Find a related model by its primary key or return new instance of the related model.
*
* @param mixed $id
* @param array<int, mixed> $columns
* @return \Illuminate\Support\Collection<int, TRelatedModel>|TRelatedModel
*/
public function findOrNew($id, $columns = ['*']);
/**
* Get the first related model record matching the attributes or instantiate it.
*
* @param array<string, mixed> $attributes
* @return TRelatedModel
*/
public function firstOrNew(array $attributes);
/**
* Get the first related record matching the attributes or create it.
*
* @param array<string, mixed> $attributes
* @param array<mixed> $joining
* @param bool $touch
* @return TRelatedModel
*/
public function firstOrCreate(array $attributes, array $joining = [], $touch = true);
/**
* Create or update a related record matching the attributes, and fill it with values.
*
* @param array<string, mixed> $attributes
* @param array<mixed> $values
* @param array<mixed> $joining
* @param bool $touch
* @return TRelatedModel
*/
public function updateOrCreate(array $attributes, array $values = [], array $joining = [], $touch = true);
/**
* Find a related model by its primary key.
*
* @param mixed $id
* @param array<int, mixed> $columns
* @return TRelatedModel|\Illuminate\Database\Eloquent\Collection<TRelatedModel>|null
*/
public function find($id, $columns = ['*']);
/**
* Find multiple related models by their primary keys.
*
* @param \Illuminate\Contracts\Support\Arrayable|int[] $ids
* @param array<int, mixed> $columns
* @return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function findMany($ids, $columns = ['*']);
/**
* Find a related model by its primary key or throw an exception.
*
* @param mixed $id
* @param array<int, mixed> $columns
* @return TRelatedModel|\Illuminate\Database\Eloquent\Collection<TRelatedModel>
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function findOrFail($id, $columns = ['*']);
/**
* Execute the query and get the first result.
*
* @param array<int, mixed> $columns
* @return TRelatedModel|null
*/
public function first($columns = ['*']);
/**
* Execute the query and get the first result or throw an exception.
*
* @param array<int, mixed> $columns
* @return TRelatedModel
*
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException
*/
public function firstOrFail($columns = ['*']);
/**
* Create a new instance of the related model.
*
* @param array<model-property<TRelatedModel>, mixed> $attributes
* @param mixed[] $joining
* @param bool $touch
* @return TRelatedModel
*/
public function create(array $attributes = [], array $joining = [], $touch = true);
/**
* Get the results of the relationship.
*
* @phpstan-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function getResults();
}