You should use the full namespace of the class in the relationship definition
Feb 19, 2015
6
Level 2
Polymorphic Relations gives Class 'Staff' not found
When I try to retriever data through a morphTo() funnction it throwa a FatalErrorException. Class 'XXX' not found.
Level 2
In your database, the column that indicate the relationship must have the namespace too.
Example: on column 'imageable_type', the value must be 'App\Staff', otherwise, see the following solution: http://stackoverflow.com/questions/27866020/laravel-returning-the-namespaced-owner-of-a-polymorphic-relation/27909753#27909753
8 likes
Please or to participate in this conversation.