Files
InvoiceShelf/app/Models/ExchangeRateProvider.php
Darko Gjorgjijoski c90dd1f2ac 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.
2026-04-03 20:32:02 +02:00

46 lines
997 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ExchangeRateProvider extends Model
{
use HasFactory;
protected $guarded = [
'id',
];
protected function casts(): array
{
return [
'currencies' => 'array',
'driver_config' => 'array',
'active' => 'boolean',
];
}
public function company(): BelongsTo
{
return $this->belongsTo(Company::class);
}
public function setCurrenciesAttribute($value)
{
$this->attributes['currencies'] = json_encode($value);
}
public function setDriverConfigAttribute($value)
{
$this->attributes['driver_config'] = json_encode($value);
}
public function scopeWhereCompany($query)
{
$query->where('exchange_rate_providers.company_id', request()->header('company'));
}
}