🤩 File Manager - Mr.X
PHP:
8.3.33
Server:
Apache
OS:
Linux 5.14.0-611.49.1.el9_7.x86_64
User:
websparkit
Navigate
Upload:
Upload
New File
New Folder
Editing:MorphMany.php
<?php namespace Illuminate\Database\Eloquent\Relations; use Illuminate\Database\Eloquent\Collection as EloquentCollection; /** * @template TRelatedModel of \Illuminate\Database\Eloquent\Model * @template TDeclaringModel of \Illuminate\Database\Eloquent\Model * * @extends \Illuminate\Database\Eloquent\Relations\MorphOneOrMany<TRelatedModel, TDeclaringModel, \Illuminate\Database\Eloquent\Collection<int, TRelatedModel>> */ class MorphMany extends MorphOneOrMany { /** * Convert the relationship to a "morph one" relationship. * * @return \Illuminate\Database\Eloquent\Relations\MorphOne<TRelatedModel, TDeclaringModel> */ public function one() { return MorphOne::noConstraints(fn () => tap( new MorphOne( $this->getQuery(), $this->getParent(), $this->morphType, $this->foreignKey, $this->localKey ), function ($morphOne) { if ($inverse = $this->getInverseRelationship()) { $morphOne->inverse($inverse); } } )); } /** @inheritDoc */ public function getResults() { return ! is_null($this->getParentKey()) ? $this->query->get() : $this->related->newCollection(); } /** @inheritDoc */ public function initRelation(array $models, $relation) { foreach ($models as $model) { $model->setRelation($relation, $this->related->newCollection()); } return $models; } /** @inheritDoc */ public function match(array $models, EloquentCollection $results, $relation) { return $this->matchMany($models, $results, $relation); } /** @inheritDoc */ public function forceCreate(array $attributes = []) { $attributes[$this->getMorphType()] = $this->morphClass; return parent::forceCreate($attributes); } }
Save Changes
Cancel
Create New File
Create New Folder