In a recent project, I had to add a constraint to a relationship to make sure it only loads one of a relationship data. Therefore if you have an application with a user where you keep track of all their activities you may have a model like this. Now when you load the user and want to bring back all of their activities you can eager load the activities by using the following code. This will return the user object with a relationship node of all the activities connected to this user.
Because this is still on a one-to-many relationship people think you have to use the hasMany method but you can use the hasOne method to only return one element, changing your lastActivitiy method to this.