This commit is contained in:
denisdulici 2017-10-09 11:17:05 +03:00
parent 033674666f
commit f8ce9ffd32
2 changed files with 7 additions and 7 deletions

View File

@ -133,7 +133,7 @@ class Items extends Controller
} }
if (isset($canDelete['invoices'])) { if (isset($canDelete['invoices'])) {
$text[] = '<b>' . $canDelete['invoices'] . '</b> ' . trans_choice('general.items', ($canDelete['invoices'] > 1) ? 2 : 1); $text[] = '<b>' . $canDelete['invoices'] . '</b> ' . trans_choice('general.invoices', ($canDelete['invoices'] > 1) ? 2 : 1);
} }
$message = trans('messages.warning.deleted', ['type' => trans_choice('general.items', 1), 'text' => implode(', ', $text)]); $message = trans('messages.warning.deleted', ['type' => trans_choice('general.items', 1), 'text' => implode(', ', $text)]);

View File

@ -49,14 +49,14 @@ class Item extends Model
return $this->belongsTo('App\Models\Setting\Tax'); 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; $error = false;
if ($bills = $this->bills()->count()) { if ($bills = $this->bill_items()->count()) {
$error['bills'] = $bills; $error['bills'] = $bills;
} }
if ($invoices = $this->invoices()->count()) { if ($invoices = $this->invoice_items()->count()) {
$error['invoices'] = $invoices; $error['invoices'] = $invoices;
} }