Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Alternate implementation to allow "safe" objects to be used by Eloquent models (without breaking mass assignment protection) #50218

Closed
wants to merge 9 commits into from
Prev Previous commit
Next Next commit
Updated forceCreate for Morphs
  • Loading branch information
x7ryan committed Feb 23, 2024
commit 0e994b0c2d73da8cbad1f9a8558f09c3142a3472
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Eloquent/Relations/MorphOneOrMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ public function addEagerConstraints(array $models)
/**
* Create a new instance of the related model. Allow mass-assignment.
*
* @param array $attributes
* @param array|\Illuminate\Support\ValidatedInput $attributes
* @return \Illuminate\Database\Eloquent\Model
*/
public function forceCreate(array $attributes = [])
public function forceCreate($attributes = [])
{
$attributes[$this->getForeignKeyName()] = $this->getParentKey();
$attributes[$this->getMorphType()] = $this->morphClass;
Expand Down