You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 16, 2023. It is now read-only.
ErrorException in Ardent.php line 821:
Invalid argument supplied for foreach()
Models:
class ModelOne extends Ardent
{
public function modelThree()
{
return $this->morphToMany('App\ModelThree', 'modelthreeable');
}
}
class ModelTwo extends Ardent
{
public function modelThree()
{
return $this->morphToMany('App\ModelThree', 'modelthreeable');
}
}
class ModelThree extends Ardent
{
public function modelOne()
{
return $this->morphedByMany('App\ModelOne', 'modelthreeable');
}
public function modelTwo()
{
return $this->morphedByMany('App\ModelTwo', 'modelthreeable');
}
}
Controller:
class ModelThreeController extends Controller
{
public function store(Request $request)
{
$modelThree = new modelThree;
$modelThree->name = $request->input('amount', NULL);
$modelOne = App\ModelOne::find($modelOneId);
$modelOne->modelThree()->save($modelThree);
}
}
(I'm aware in the code above ModelTwo is not being touched)
The text was updated successfully, but these errors were encountered:
zakiaziz
changed the title
Trying to save a polymorphic relationship yields
Trying to save a polymorphic relationship yields ErrorException
Jan 3, 2016
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The error I'm receiving:
Models:
Controller:
(I'm aware in the code above
ModelTwo
is not being touched)The text was updated successfully, but these errors were encountered: