Management UI at link.ladill.com with GHS 0.05 per link wallet billing, click analytics, and legacy fallback to ladill.com/q for QR ecosystem codes. Co-authored-by: Cursor <cursoragent@cursor.com>
40 lines
816 B
PHP
40 lines
816 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class LinkWallet extends Model
|
|
{
|
|
public const STATUS_ACTIVE = 'active';
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'links_total',
|
|
'clicks_total',
|
|
'status',
|
|
];
|
|
|
|
protected $casts = [
|
|
'links_total' => 'integer',
|
|
'clicks_total' => 'integer',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function transactions(): HasMany
|
|
{
|
|
return $this->hasMany(LinkTransaction::class);
|
|
}
|
|
|
|
public static function pricePerLink(): float
|
|
{
|
|
return (float) config('link.price_per_link_ghs', 0.05);
|
|
}
|
|
}
|