diff --git a/app/Http/Controllers/Items/Items.php b/app/Http/Controllers/Items/Items.php
index a8d4f920e..88d753924 100644
--- a/app/Http/Controllers/Items/Items.php
+++ b/app/Http/Controllers/Items/Items.php
@@ -133,7 +133,7 @@ class Items extends Controller
}
if (isset($canDelete['invoices'])) {
- $text[] = '' . $canDelete['invoices'] . ' ' . trans_choice('general.items', ($canDelete['invoices'] > 1) ? 2 : 1);
+ $text[] = '' . $canDelete['invoices'] . ' ' . trans_choice('general.invoices', ($canDelete['invoices'] > 1) ? 2 : 1);
}
$message = trans('messages.warning.deleted', ['type' => trans_choice('general.items', 1), 'text' => implode(', ', $text)]);
diff --git a/app/Models/Item/Item.php b/app/Models/Item/Item.php
index 9694eea1e..eaf593a1b 100644
--- a/app/Models/Item/Item.php
+++ b/app/Models/Item/Item.php
@@ -49,14 +49,14 @@ class Item extends Model
return $this->belongsTo('App\Models\Setting\Tax');
}
- public function bills()
+ public function bill_items()
{
- return $this->hasMany('App\Models\Expense\Bill');
+ return $this->hasMany('App\Models\Expense\BillItem');
}
- public function invoices()
+ public function invoice_items()
{
- return $this->hasMany('App\Models\Income\Invoice');
+ return $this->hasMany('App\Models\Income\InvoiceItem');
}
/**
@@ -85,11 +85,11 @@ class Item extends Model
{
$error = false;
- if ($bills = $this->bills()->count()) {
+ if ($bills = $this->bill_items()->count()) {
$error['bills'] = $bills;
}
- if ($invoices = $this->invoices()->count()) {
+ if ($invoices = $this->invoice_items()->count()) {
$error['invoices'] = $invoices;
}