I have 2 related tables and I want to show 1 data that has only one "pulling" this relationship.
tables:
Users:
Permissions:
Tablethatwilllist:
Code:
@foreach(App\User::all()as$user)<tr><td>{{$user->id}}</td><td>{{$user->name}}</td><td>{{$user->permission->name}}</td><td>{{$user->email}}</td></tr>@endforeach
Model"User":
public function permission()
{
return $this->hasOne('App\Permission', 'id', 'role');
}
error: