Remove dead model methods now handled by services

Remove createItem/updateItem from Item, createTransaction/
completeTransaction/failedTransaction from Transaction,
createCustomField/updateCustomField from CustomField, all business
methods from ExchangeRateProvider (CRUD + API checks + URL helpers),
and validateCredentials/createDisk/updateDisk/updateDefaultDisks/
setAsDefaultDisk from FileDisk.

All logic now lives in their respective service classes.
This commit is contained in:
Darko Gjorgjijoski
2026-04-03 20:32:02 +02:00
parent 85b62dfdf8
commit c90dd1f2ac
5 changed files with 0 additions and 294 deletions

View File

@@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Support\Facades\Auth;
class Item extends Model
{
@@ -135,45 +134,4 @@ class Item extends Model
{
return $this->hasMany(EstimateItem::class);
}
public static function createItem($request)
{
$data = $request->validated();
$data['company_id'] = $request->header('company');
$data['creator_id'] = Auth::id();
$company_currency = CompanySetting::getSetting('currency', $request->header('company'));
$data['currency_id'] = $company_currency;
$item = self::create($data);
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
$item->tax_per_item = true;
$item->save();
$tax['company_id'] = $request->header('company');
$item->taxes()->create($tax);
}
}
$item = self::with('taxes')->find($item->id);
return $item;
}
public function updateItem($request)
{
$this->update($request->validated());
$this->taxes()->delete();
if ($request->has('taxes')) {
foreach ($request->taxes as $tax) {
$this->tax_per_item = true;
$this->save();
$tax['company_id'] = $request->header('company');
$this->taxes()->create($tax);
}
}
return Item::with('taxes')->find($this->id);
}
}