laravel/framework — pull request #5853 by manavo (2014-09-26 21:06:59+00:00)
Title: Only propagate the touchOwners call if a relationship exists

The problem is in the case of a belongsTo relationship (that I came across).

If the foreign key is nullable and could be null, this throws an error of:

```
Fatal error: Call to a member function touchOwners() on a non-object
```

This fix checks that the relationship exists before trying to propagate the call (since the result might be null).

Unit tests attached to demonstrate the problem before and pass with the change in the Model class.