How does one go about this? I tried this:
return $this->hasMany(ResolutionLog::class, 'ant_id', 'id')->with('resolutionStatus');
and got the error:
Call to undefined relationship [resolutionLog] on model [App\Models\ResolutionLog].
Or in tinker I'm getting this error when get a resolutionLog collection and attempt to access the resolutionStatus relationship:
LogicException with message 'App/Models/ResolutionLog::resolutionStatus must return a relationship instance.'
Here is the resolutionStatus relationship on the ResolutionLog model:
public function resolutionStatus()
{
$this->hasOne(ResolutionStatus::class, 'id', 'resolution_status_id');
}
And the resolutionLog relationship on the ResolutionStatus model:
public function resolutionLog()
{
return $this->hasMany(ResolutionLog::class, 'resolution_status_id', 'id');
}
It should be a one->many relationship between a ResolutionLog has one ResolutionStatus. A ResolutionStatus can have many ResolutionLogs.
from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2Sb3AKM
via IFTTT
Aucun commentaire:
Enregistrer un commentaire