update rm deadcode

This commit is contained in:
baodev0
2026-09-27 11:42:40 +07:00
parent 82a71244ca
commit 3af59bd9c5
129 changed files with 5194 additions and 2698 deletions
+7
View File
@@ -43,6 +43,13 @@ class DomainPricing extends Model
return is_numeric($value) ? (int) $value : (string) $value;
}
public function orderPrice(int $years): int
{
$setupFee = is_numeric($this->setup_fee) ? (int) $this->setup_fee : 0;
return $setupFee + (int) $this->first_year + (int) $this->recurring_fee * (max(1, $years) - 1);
}
public function toDomainArray(): array
{
return [
+6
View File
@@ -52,6 +52,12 @@ class Invoice extends Model
return $this->hasMany(Service::class, 'invoice_id');
}
/** The service this invoice upgrades, for invoice_type = 3 (upgrade). */
public function service()
{
return $this->belongsTo(Service::class, 'service_id');
}
public function payment()
{
+5
View File
@@ -27,6 +27,11 @@ class InvoiceItem extends Model
return $this->belongsTo(Product::class, 'product_id');
}
public function addon()
{
return $this->belongsTo(Addon::class, 'addon_id');
}
// -------------------------------------------------------------------------
// Helpers
// -------------------------------------------------------------------------
+2
View File
@@ -10,10 +10,12 @@ class RefreshToken extends Model
'customer_id',
'token',
'expires_at',
'revoked_at',
];
protected $casts = [
'expires_at' => 'datetime',
'revoked_at' => 'datetime',
];
public function customer()
+1
View File
@@ -30,6 +30,7 @@ class ReinstallLog extends Model
'started_at' => 'datetime',
'completed_at' => 'datetime',
'password_supplied_by_customer' => 'boolean',
'plain_password' => 'encrypted',
];
public const PRODUCT_TYPE_VPS = 4;
+7
View File
@@ -20,6 +20,11 @@ class Service extends Model
protected $table = 'services';
public const HOSTING_ACCOUNT_RELATIONS = [
'hostingAccount.server:id,name,ip_address',
'hostingAccount.domain:id,domain_name',
];
protected $fillable = [
'uuid',
'customer_id',
@@ -38,6 +43,8 @@ class Service extends Model
'refunded_at',
'retry_requested_at',
'note',
'requirements',
'feedback',
'registrar_reference',
'kyc_url',
'rejection_reason',
+11 -11
View File
@@ -6,7 +6,7 @@ use App\Traits\LogsActivity;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Facades\URL;
use App\Traits\HasUuid;
class Transaction extends Model
@@ -61,12 +61,6 @@ class Transaction extends Model
};
}
/**
* `proof_image` stores either a single relative storage path, or a
* JSON-encoded array of paths (admin-created service with multiple
* proofs). Resolve both shapes into absolute, browsable URLs so the
* raw path string never leaks into the frontend as a literal href.
*/
public function getProofImageUrlsAttribute(): array
{
if (! $this->proof_image) {
@@ -78,9 +72,15 @@ class Transaction extends Model
$paths = [$this->proof_image];
}
return array_values(array_map(
fn (string $path) => Storage::disk('public')->url($path),
array_filter($paths, fn ($path) => is_string($path) && $path !== '')
));
$paths = array_values(array_filter($paths, fn ($path) => is_string($path) && $path !== ''));
return array_map(
fn (int $index) => URL::temporarySignedRoute(
'admin.transactions.proof-image',
now()->addDay(),
['transaction' => $this->uuid, 'index' => $index],
),
array_keys($paths),
);
}
}