Error 500:

Trying to get property 'id' of non-object