10, 'email' => 5, 'phone' => 2, 'website' => 2, 'address' => 1, ]; public function bills() { return $this->hasMany('App\Models\Expense\Bill'); } public function payments() { return $this->hasMany('App\Models\Expense\Payments'); } public function currency() { return $this->belongsTo('App\Models\Setting\Currency', 'currency_code', 'code'); } public function canDelete() { $error = false; if ($bills = $this->bills()->count()) { $error['bills'] = $bills; } if ($payments = $this->payments()->count()) { $error['payments'] = $payments; } if ($error) { return $error; } return true; } }