twg_
208
8
Laravel

Issues returning value from relationship

Posted 3 years ago by twg_

I'm having an issue with calling a field from a linked table.

Degree

public function type()
{
    $this->hasOne('App\DegreeType', 'id', 'degree_type');
}

View

<td>{{ $degree->type->title }}</td>

My degree_types table has the following: id, title, created_at, updated_at, deleted_at.

What am I doing wrong?

Please sign in or create an account to participate in this conversation.