relationOrders('id_invoice'); } public function getPayments() { return $this->hasMany(Payment::class, ['id_invoice' => 'id']) ->orderBy(['payment.id' => SORT_DESC]); } }