cafeg/app/Models/Promocode.php
2025-08-07 14:06:02 +08:00

26 lines
512 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Promocode extends Model
{
//
protected $table = 'promocodes';
protected $guarded = [];
public function getMember()
{
return $this->hasOne(Member::class, 'id', 'used_count');
}
public function getFromLabelAttribute()
{
return match ($this->from) {
'cafeg' => '朗立臣',
'teamaster' => '飲力星球',
default => '未知來源',
};
}
}