Files
Kol-Manager/app/Models/RateCard.php
2026-04-01 08:04:56 +07:00

37 lines
871 B
PHP

<?php
declare(strict_types=1);
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class RateCard extends Model
{
protected $fillable = [
'service_name', 'description', 'platform', 'content_type',
'price', 'currency', 'price_unit', 'is_negotiable', 'is_active', 'sort_order',
];
protected $casts = [
'price' => 'decimal:2',
'is_negotiable' => 'boolean',
'is_active' => 'boolean',
];
public function getFormattedPriceAttribute(): string
{
return 'Rp ' . number_format((float) $this->price, 0, ',', '.');
}
public function getPlatformIconAttribute(): string
{
return match($this->platform) {
'instagram' => '📸',
'tiktok' => '🎵',
'youtube' => '▶️',
default => '⭐',
};
}
}