Closed
Description
I am having problems with morph relations one-to-one, because of _type and _id can sometimes be null.
The looks like this.
subscription_type | subscription_id |
---|---|
Creditcard | 1 |
Creditcard | 2 |
(null) | (null) |
Creditcard | 2 |
When morphTo calls the (null) // (null) relation the script crashes because of a sql error.
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'invoices.' in 'where clause' (SQL: select * from `invoices` where `invoices`.`` is null limit 1)
I want to be able to define in morphTo, that if subscription_type and subscription_id is null then return null or a new model.
Metadata
Metadata
Assignees
Labels
No labels