initial commit
This commit is contained in:
36
app/Models/RateCard.php
Normal file
36
app/Models/RateCard.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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 => '⭐',
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user