hi, it seems like belongsTo are not using foreignkey like the example given
currently im using version 2.0.2
Example:
public function a()
{
return $this->belongsTo('A', ['foreignKey1', 'foreignKey2'], ['localKey1', 'localKey2']);
}
because when i tried to do as example in my code
My Code:
public function order()
{
return $this->belongsTo(Order::class, ['id', 'store_id'], ['order_id', 'store_id']);
}
it returns to me an error saying that
Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'orders.order_id' in 'where clause' (SQL: select * from `orders` where ((`orders`. `order_id` = 1 and `orders`.`store_id` = 2)) and `orders`.`deleted_at` is null)'
which from the error we can clearly see it is not using the foreignkey(id) given on it
hi, it seems like belongsTo are not using foreignkey like the example given currently im using version 2.0.2
Example:
because when i tried to do as example in my code
My Code:
it returns to me an error saying that
Illuminate/Database/QueryException with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'orders.order_id' in 'where clause' (SQL: select * from `orders` where ((`orders`. `order_id` = 1 and `orders`.`store_id` = 2)) and `orders`.`deleted_at` is null)'
which from the error we can clearly see it is not using the foreignkey(
id
) given on itThanks!