<?php
 namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class ServiceCost extends Model { use HasFactory; protected $fillable = [ 'product_id', 'is_active', 'metadata', ]; protected $casts = [ 'is_active' => 'boolean', 'metadata' => 'array', ]; const PERIOD_DAILY = 'daily'; const PERIOD_MONTHLY = 'monthly'; const PERIOD_YEARLY = 'yearly'; public static function getPeriodTypeOptions(): array { return [ self::PERIOD_DAILY => __('models.service_cost.period_daily'), self::PERIOD_MONTHLY => __('models.service_cost.period_monthly'), self::PERIOD_YEARLY => __('models.service_cost.period_yearly'), ]; } public static function getCategoryOptions(): array { return []; } public function getPeriodTypeLabelAttribute(): string { return ''; } public function getCategoryLabelAttribute(): string { return ''; } public function isCurrentlyActive(): bool { return (bool) $this->is_active; } public function getMonthlyCost(): float { return 0.0; } public function getYearlyCost(): float { return 0.0; } public function scopeActive($query) { return $query->where('is_active', true); } public function scopeByCategory($query, $category) { return $query; } public function scopeByPeriodType($query, $periodType) { return $query; } public function product() { return $this->belongsTo(Product::class, 'product_id'); } public function currency() { return null; } } 