Hello,
The attribute names of eagerly loaded polymorphic relationships are using snake casing, while other relationships (e.g., BelongsTo) are named in camel casing fashion. Example:
class Payment extends Model
{
public function paymentProfile()
{
return $this->belongsTo(PaymentProfile::class);
}
public function paymentDetails()
{
return $this->morphTo();
}
}
Behaviour:
$payment = Payment::with('paymentProfile', 'paymentDetails')->first();
var_dump($payment->paymentProfile); // PaymentProfile instance
var_dump($payment->paymentDetails); // NULL
var_dump($payment->payment_details); // SepaDirectDebitPaymentDetails instance
If I remember correctly, it should be independent of the relation type used and should follow the method's name (PaymentDetails in this case).
Jarno